annotate truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/UnsupportedSpecializationTest.java @ 22241:14e6dfb1ef05

Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation" - Caused by lack of a "vm" known to the Accessor during most testing, making the Instrumenter unavailable, which is now required to create a CallTarget - Modified the Instrumenter/Accessor with a static field that can be reflectively "poked" with a vm value for testing - Create a pair of methods to globally enable/disable testing mode to modify that static field and restore it when tests complete.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 22 Sep 2015 20:31:19 -0700
parents dc83cc1f94f2
children 0d36601f233e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13812
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
1 /*
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
4 *
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
8 *
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
13 * accompanied this code).
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
14 *
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
18 *
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
21 * questions.
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
22 */
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
23 package com.oracle.truffle.api.dsl.test;
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
24
22241
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
25 import java.util.List;
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
26
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
27 import org.junit.After;
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
28 import org.junit.Assert;
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
29 import org.junit.Before;
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
30 import org.junit.Test;
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
31
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
32 import com.oracle.truffle.api.dsl.NodeChild;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
33 import com.oracle.truffle.api.dsl.NodeChildren;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
34 import com.oracle.truffle.api.dsl.ShortCircuit;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
35 import com.oracle.truffle.api.dsl.Specialization;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
36 import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
13812
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
37 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode;
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
38 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode;
13861
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
39 import com.oracle.truffle.api.dsl.test.UnsupportedSpecializationTestFactory.Unsupported1Factory;
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
40 import com.oracle.truffle.api.dsl.test.UnsupportedSpecializationTestFactory.Unsupported2Factory;
22241
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
41 import com.oracle.truffle.api.dsl.test.utilities.InstrumentationTestMode;
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
42 import com.oracle.truffle.api.nodes.Node;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
43 import com.oracle.truffle.api.nodes.NodeUtil;
13812
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
44
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
45 public class UnsupportedSpecializationTest {
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
46
22241
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
47 @Before
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
48 public void before() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
49 InstrumentationTestMode.set(true);
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
50 }
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
51
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
52 @After
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
53 public void after() throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
54 InstrumentationTestMode.set(false);
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
55 }
14e6dfb1ef05 Truffle/Testing: massive rework of tests to accommodate recent instrumentation change with respect to "applyInstrumentation"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22157
diff changeset
56
13812
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
57 @Test
13861
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
58 public void testUnsupported1() {
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
59 TestRootNode<Unsupported1> root = TestHelper.createRoot(Unsupported1Factory.getInstance());
13812
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
60 try {
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
61 TestHelper.executeWith(root, "");
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
62 Assert.fail();
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
63 } catch (UnsupportedSpecializationException e) {
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
64 Assert.assertNotNull(e.getSuppliedValues());
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
65 Assert.assertEquals(1, e.getSuppliedValues().length);
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
66 Assert.assertEquals("", e.getSuppliedValues()[0]);
13861
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
67 Assert.assertSame(root.getNode().getChildren().iterator().next(), e.getSuppliedNodes()[0]);
13812
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
68 Assert.assertEquals(root.getNode(), e.getNode());
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
69 }
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
70 }
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
71
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
72 @NodeChild("a")
13861
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
73 abstract static class Unsupported1 extends ValueNode {
13812
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
74
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
75 @Specialization
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
76 public int doInteger(@SuppressWarnings("unused") int a) {
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
77 throw new AssertionError();
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
78 }
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
79 }
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
80
13861
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
81 @Test
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
82 public void testUnsupported2() {
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
83 TestRootNode<Unsupported2> root = TestHelper.createRoot(Unsupported2Factory.getInstance());
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
84 try {
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
85 TestHelper.executeWith(root, "", 1);
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
86 Assert.fail();
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
87 } catch (UnsupportedSpecializationException e) {
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
88 Assert.assertNotNull(e.getSuppliedValues());
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
89 Assert.assertNotNull(e.getSuppliedNodes());
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
90 Assert.assertEquals(3, e.getSuppliedValues().length);
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
91 Assert.assertEquals(3, e.getSuppliedNodes().length);
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
92 Assert.assertEquals("", e.getSuppliedValues()[0]);
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
93 Assert.assertEquals(false, e.getSuppliedValues()[1]);
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
94 Assert.assertEquals(null, e.getSuppliedValues()[2]);
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
95 List<Node> children = NodeUtil.findNodeChildren(root.getNode());
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
96 Assert.assertSame(children.get(0), e.getSuppliedNodes()[0]);
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
97 Assert.assertNull(e.getSuppliedNodes()[1]);
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
98 Assert.assertSame(children.get(1), e.getSuppliedNodes()[2]);
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
99 Assert.assertEquals(root.getNode(), e.getNode());
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
100 }
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
101 }
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
102
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
103 @SuppressWarnings("unused")
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
104 @NodeChildren({@NodeChild("a"), @NodeChild("b")})
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
105 abstract static class Unsupported2 extends ValueNode {
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
106
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
107 @ShortCircuit("b")
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
108 public boolean needsB(Object a) {
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
109 return false;
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
110 }
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
111
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
112 @Specialization
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
113 public int doInteger(int a, boolean hasB, int b) {
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
114 throw new AssertionError();
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
115 }
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
116 }
28479abd1a69 Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
Christian Humer <christian.humer@gmail.com>
parents: 13812
diff changeset
117
13812
f270f09616da Truffle-DSL: implemented specific structured exception for unsupported specializations. (GRAAL-682)
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
118 }