annotate truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/AssumptionsTest.java @ 22157:dc83cc1f94f2

Using fully qualified imports
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Wed, 16 Sep 2015 11:33:22 +0200
parents 9c8c0937da41
children 14e6dfb1ef05
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
1 /*
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
4 *
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
8 *
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
13 * accompanied this code).
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
14 *
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
18 *
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
21 * questions.
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
22 */
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
23 package com.oracle.truffle.api.dsl.test;
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
24
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
25 import com.oracle.truffle.api.Assumption;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
26 import com.oracle.truffle.api.CallTarget;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
27 import com.oracle.truffle.api.Truffle;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
28 import com.oracle.truffle.api.dsl.Cached;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
29 import com.oracle.truffle.api.dsl.NodeChild;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
30 import com.oracle.truffle.api.dsl.NodeField;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
31 import com.oracle.truffle.api.dsl.Specialization;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
32 import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
33 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.AssumptionArrayTestFactory;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
34 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.CacheAssumptionTestFactory;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
35 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.FieldTestFactory;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
36 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.MethodTestFactory;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
37 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.NodeFieldTest2Factory;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
38 import com.oracle.truffle.api.dsl.test.AssumptionsTestFactory.StaticFieldTestFactory;
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
39 import static com.oracle.truffle.api.dsl.test.TestHelper.createCallTarget;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
40 import static com.oracle.truffle.api.dsl.test.TestHelper.getNode;
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
41 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode;
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
42 import java.util.HashMap;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
43 import java.util.Map;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
44 import static org.junit.Assert.assertEquals;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
45 import static org.junit.Assert.fail;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
46 import org.junit.Test;
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
47
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
48 public class AssumptionsTest {
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
49
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
50 @Test
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
51 public void testField() {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
52 CallTarget root = createCallTarget(FieldTestFactory.getInstance());
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
53 FieldTest node = getNode(root);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
54 assertEquals(42, root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
55 assertEquals(42, root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
56 node.field.invalidate();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
57 try {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
58 root.call(45);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
59 fail();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
60 } catch (UnsupportedSpecializationException e) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
61 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
62 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
63
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
64 @NodeChild
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
65 static class FieldTest extends ValueNode {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
66
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
67 protected final Assumption field = Truffle.getRuntime().createAssumption();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
68
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
69 @Specialization(assumptions = "field")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
70 static int do1(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
71 return value;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
72 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
73 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
74
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
75 @Test
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
76 public void testNodeField() {
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
77 Assumption assumption = Truffle.getRuntime().createAssumption();
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
78 CallTarget root = createCallTarget(NodeFieldTest2Factory.getInstance(), assumption);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
79 assertEquals(42, root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
80 assertEquals(42, root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
81 assumption.invalidate();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
82 try {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
83 root.call(45);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
84 fail();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
85 } catch (UnsupportedSpecializationException e) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
86 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
87 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
88
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
89 @NodeChild
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
90 @NodeField(name = "field", type = Assumption.class)
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
91 static class NodeFieldTest2 extends ValueNode {
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
92
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
93 @Specialization(assumptions = "field")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
94 static int do1(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
95 return value;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
96 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
97 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
98
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
99 @Test
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
100 public void testStaticField() {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
101 CallTarget root = createCallTarget(StaticFieldTestFactory.getInstance());
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
102 assertEquals(42, root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
103 assertEquals(42, root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
104 StaticFieldTest.FIELD.invalidate();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
105 try {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
106 root.call(45);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
107 fail();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
108 } catch (UnsupportedSpecializationException e) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
109 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
110 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
111
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
112 @NodeChild
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
113 static class StaticFieldTest extends ValueNode {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
114
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
115 static final Assumption FIELD = Truffle.getRuntime().createAssumption();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
116
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
117 @Specialization(assumptions = "FIELD")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
118 static int do1(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
119 return value;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
120 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
121 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
122
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
123 @Test
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
124 public void testMethod() {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
125 CallTarget root = createCallTarget(MethodTestFactory.getInstance());
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
126 MethodTest node = getNode(root);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
127 assertEquals(42, root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
128 assertEquals(42, root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
129 node.hiddenAssumption.invalidate();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
130 try {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
131 root.call(45);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
132 fail();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
133 } catch (UnsupportedSpecializationException e) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
134 }
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
135 }
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
136
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
137 @NodeChild
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
138 static class MethodTest extends ValueNode {
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
139
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
140 private final Assumption hiddenAssumption = Truffle.getRuntime().createAssumption();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
141
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
142 @Specialization(assumptions = "getAssumption()")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
143 static int do1(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
144 return value;
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
145 }
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
146
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
147 Assumption getAssumption() {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
148 return hiddenAssumption;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
149 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
150 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
151
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
152 @Test
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
153 public void testCacheAssumption() {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
154 CallTarget root = createCallTarget(CacheAssumptionTestFactory.getInstance());
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
155 CacheAssumptionTest node = getNode(root);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
156 assertEquals("do1", root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
157 assertEquals("do1", root.call(43));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
158 assertEquals("do1", root.call(44));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
159 node.assumptions.get(42).invalidate();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
160 node.assumptions.put(42, null); // clear 42
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
161 node.assumptions.get(43).invalidate();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
162 node.assumptions.get(44).invalidate();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
163 assertEquals("do1", root.call(42)); // recreates 42
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
164 assertEquals("do2", root.call(43)); // invalid 43 -> remove -> insert do2
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
165 assertEquals("do2", root.call(46)); // no more lines can be created.
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
166 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
167
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
168 @Test
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
169 public void testCacheAssumptionLimit() {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
170 CallTarget root = createCallTarget(CacheAssumptionTestFactory.getInstance());
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
171 assertEquals("do1", root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
172 assertEquals("do1", root.call(43));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
173 assertEquals("do1", root.call(44));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
174 assertEquals("do2", root.call(45));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
175 assertEquals("do1", root.call(43));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
176 assertEquals("do1", root.call(44));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
177 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
178
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
179 @NodeChild
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
180 @SuppressWarnings("unused")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
181 static class CacheAssumptionTest extends ValueNode {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
182
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
183 private final Map<Integer, Assumption> assumptions = new HashMap<>();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
184
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
185 @Specialization(guards = "value == cachedValue", assumptions = "getAssumption(cachedValue)")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
186 static String do1(int value, @Cached("value") int cachedValue) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
187 return "do1";
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
188 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
189
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
190 @Specialization
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
191 static String do2(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
192 return "do2";
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
193 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
194
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
195 Assumption getAssumption(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
196 Assumption assumption = assumptions.get(value);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
197 if (assumption == null) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
198 assumption = Truffle.getRuntime().createAssumption();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
199 assumptions.put(value, assumption);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
200 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
201 return assumption;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
202 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
203 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
204
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
205 @Test
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
206 public void testAssumptionArrays() {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
207 CallTarget root = createCallTarget(AssumptionArrayTestFactory.getInstance());
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
208 AssumptionArrayTest node = getNode(root);
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
209
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
210 Assumption a1 = Truffle.getRuntime().createAssumption();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
211 Assumption a2 = Truffle.getRuntime().createAssumption();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
212
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
213 node.assumptions = new Assumption[]{a1, a2};
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
214
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
215 assertEquals("do1", root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
216
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
217 a2.invalidate();
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
218
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
219 assertEquals("do2", root.call(42));
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
220 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
221
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
222 @NodeChild
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
223 @SuppressWarnings("unused")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
224 static class AssumptionArrayTest extends ValueNode {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
225
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
226 Assumption[] assumptions;
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
227
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
228 @Specialization(assumptions = "assumptions")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
229 static String do1(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
230 return "do1";
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
231 }
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
232
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
233 @Specialization
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
234 static String do2(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
235 return "do2";
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
236 }
16756
5148aab962af Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents: 10597
diff changeset
237
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
238 }
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
239
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
240 @NodeChild
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
241 static class ErrorIncompatibleReturnType extends ValueNode {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
242 @ExpectError("Incompatible return type int. Assumptions must be assignable to Assumption or Assumption[].")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
243 @Specialization(assumptions = "3")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
244 static int do1(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
245 return value;
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
246 }
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
247 }
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
248
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
249 @NodeChild
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
250 static class ErrorBoundDynamicValue extends ValueNode {
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
251
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
252 @ExpectError("Assumption expressions must not bind dynamic parameter values.")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
253 @Specialization(assumptions = "createAssumption(value)")
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
254 static int do1(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
255 return value;
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
256 }
16756
5148aab962af Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents: 10597
diff changeset
257
19291
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
258 Assumption createAssumption(int value) {
f4792a544170 Truffle-DSL: implement new assumptions semantics.
Christian Humer <christian.humer@gmail.com>
parents: 16760
diff changeset
259 return Truffle.getRuntime().createAssumption(String.valueOf(value));
10597
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
260 }
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
261 }
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
262
79041ab43660 Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
263 }