diff graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemTest.java @ 16756:5148aab962af

Truffle-DSL: updated tests for the new generation layout.
author Christian Humer <christian.humer@gmail.com>
date Mon, 11 Aug 2014 15:53:05 +0200
parents 64dcb92ee75a
children c3c07046a74b
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemTest.java	Mon Aug 11 15:53:05 2014 +0200
+++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemTest.java	Mon Aug 11 15:53:05 2014 +0200
@@ -22,6 +22,8 @@
  */
 package com.oracle.truffle.api.dsl.test;
 
+import java.math.*;
+
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.frame.*;
@@ -29,7 +31,7 @@
 
 public class TypeSystemTest {
 
-    @TypeSystem({int.class, boolean.class, String.class, CallTarget.class, BExtendsAbstract.class, CExtendsAbstract.class, Abstract.class, Object[].class})
+    @TypeSystem({int.class, double.class, boolean.class, BigInteger.class, String.class, CallTarget.class, BExtendsAbstract.class, CExtendsAbstract.class, Abstract.class, Object[].class})
     static class SimpleTypes {
 
         static int intCheck;
@@ -47,10 +49,20 @@
             return (int) value;
         }
 
+        @ImplicitCast
+        public double castDouble(int value) {
+            return value;
+        }
+
+        @ImplicitCast
+        public BigInteger castBigInteger(int value) {
+            return BigInteger.valueOf(value);
+        }
+
     }
 
     @TypeSystemReference(SimpleTypes.class)
-    public abstract static class ValueNode extends Node {
+    public static class ValueNode extends Node {
 
         public ValueNode() {
             super(null);
@@ -72,6 +84,10 @@
             return SimpleTypesGen.SIMPLETYPES.expectObjectArray(execute(frame));
         }
 
+        public BigInteger executeBigInteger(VirtualFrame frame) throws UnexpectedResultException {
+            return SimpleTypesGen.SIMPLETYPES.expectBigInteger(execute(frame));
+        }
+
         public BExtendsAbstract executeBExtendsAbstract(VirtualFrame frame) throws UnexpectedResultException {
             return SimpleTypesGen.SIMPLETYPES.expectBExtendsAbstract(execute(frame));
         }
@@ -80,7 +96,17 @@
             return SimpleTypesGen.SIMPLETYPES.expectCExtendsAbstract(execute(frame));
         }
 
-        public abstract Object execute(VirtualFrame frame);
+        public Abstract executeAbstract(VirtualFrame frame) throws UnexpectedResultException {
+            return SimpleTypesGen.SIMPLETYPES.expectAbstract(execute(frame));
+        }
+
+        public double executeDouble(VirtualFrame frame) throws UnexpectedResultException {
+            return SimpleTypesGen.SIMPLETYPES.expectDouble(execute(frame));
+        }
+
+        public Object execute(@SuppressWarnings("unused") VirtualFrame frame) {
+            throw new UnsupportedOperationException();
+        }
 
         @Override
         public ValueNode copy() {