Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TestHelper.java @ 20940:476374f3fe9a
Truffle-DSL: generate better polymorphic execute signatures
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 14 Apr 2015 15:12:48 +0200 |
parents | 62c43fcf5be2 |
children |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TestHelper.java Tue Apr 14 15:12:48 2015 +0200 +++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TestHelper.java Tue Apr 14 15:12:48 2015 +0200 @@ -32,12 +32,27 @@ import com.oracle.truffle.api.dsl.test.TypeSystemTest.ChildrenNode; import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; +import com.oracle.truffle.api.frame.*; +import com.oracle.truffle.api.nodes.*; /** * Utility class to provide some test helper functions. */ class TestHelper { + // make nodes replacable + public static <T extends Node> T createRoot(final T node) { + new RootNode() { + @Child T child = node; + + @Override + public Object execute(VirtualFrame frame) { + return null; + } + }.adoptChildren(); + return node; + } + private static ArgumentNode[] arguments(int count) { ArgumentNode[] nodes = new ArgumentNode[count]; for (int i = 0; i < nodes.length; i++) {