Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ExecuteEvaluatedTest.java @ 14991:64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Sun, 06 Apr 2014 17:46:24 +0200 |
parents | 17b116b80aba |
children | a665483c3881 |
comparison
equal
deleted
inserted
replaced
14989:a0dbb3628f2a | 14991:64dcb92ee75a |
---|---|
37 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs5Factory; | 37 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.TestEvaluatedVarArgs5Factory; |
38 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.UseDoubleEvaluatedNodeFactory; | 38 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.UseDoubleEvaluatedNodeFactory; |
39 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.UseEvaluatedNodeFactory; | 39 import com.oracle.truffle.api.dsl.test.ExecuteEvaluatedTestFactory.UseEvaluatedNodeFactory; |
40 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode; | 40 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ArgumentNode; |
41 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ChildrenNode; | 41 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ChildrenNode; |
42 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestArguments; | |
43 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; | 42 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; |
44 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; | 43 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; |
45 import com.oracle.truffle.api.frame.*; | 44 import com.oracle.truffle.api.frame.*; |
46 import com.oracle.truffle.api.nodes.*; | 45 import com.oracle.truffle.api.nodes.*; |
47 | 46 |
50 @Test | 49 @Test |
51 public void testSingleEvaluated() { | 50 public void testSingleEvaluated() { |
52 ArgumentNode arg0 = new ArgumentNode(0); | 51 ArgumentNode arg0 = new ArgumentNode(0); |
53 CallTarget callTarget = TestHelper.createCallTarget(UseEvaluatedNodeFactory.create(arg0, EvaluatedNodeFactory.create(null))); | 52 CallTarget callTarget = TestHelper.createCallTarget(UseEvaluatedNodeFactory.create(arg0, EvaluatedNodeFactory.create(null))); |
54 | 53 |
55 Assert.assertEquals(43, callTarget.call(new TestArguments(42))); | 54 Assert.assertEquals(43, callTarget.call(new Object[]{42})); |
56 Assert.assertEquals(1, arg0.getInvocationCount()); | 55 Assert.assertEquals(1, arg0.getInvocationCount()); |
57 } | 56 } |
58 | 57 |
59 @NodeChild("exp") | 58 @NodeChild("exp") |
60 abstract static class EvaluatedNode extends ValueNode { | 59 abstract static class EvaluatedNode extends ValueNode { |
83 public void testDoubleEvaluated() { | 82 public void testDoubleEvaluated() { |
84 ArgumentNode arg0 = new ArgumentNode(0); | 83 ArgumentNode arg0 = new ArgumentNode(0); |
85 ArgumentNode arg1 = new ArgumentNode(1); | 84 ArgumentNode arg1 = new ArgumentNode(1); |
86 CallTarget callTarget = TestHelper.createCallTarget(UseDoubleEvaluatedNodeFactory.create(arg0, arg1, DoubleEvaluatedNodeFactory.create(null, null))); | 85 CallTarget callTarget = TestHelper.createCallTarget(UseDoubleEvaluatedNodeFactory.create(arg0, arg1, DoubleEvaluatedNodeFactory.create(null, null))); |
87 | 86 |
88 Assert.assertEquals(85, callTarget.call(new TestArguments(42, 43))); | 87 Assert.assertEquals(85, callTarget.call(new Object[]{42, 43})); |
89 Assert.assertEquals(1, arg0.getInvocationCount()); | 88 Assert.assertEquals(1, arg0.getInvocationCount()); |
90 Assert.assertEquals(1, arg1.getInvocationCount()); | 89 Assert.assertEquals(1, arg1.getInvocationCount()); |
91 } | 90 } |
92 | 91 |
93 @NodeChildren({@NodeChild("exp0"), @NodeChild("exp1")}) | 92 @NodeChildren({@NodeChild("exp0"), @NodeChild("exp1")}) |