diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/TypeSystemParser.java @ 10600:e93efe3ba5f4

Truffle-DSL: rewritten polymorphic optimization for simpler generated code.
author Christian Humer <christian.humer@gmail.com>
date Tue, 02 Jul 2013 14:51:05 +0200
parents 79041ab43660
children 4830676526e3
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/TypeSystemParser.java	Mon Jul 01 21:08:20 2013 +0200
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/TypeSystemParser.java	Tue Jul 02 14:51:05 2013 +0200
@@ -76,7 +76,7 @@
         }
 
         TypeMirror genericType = context.getType(Object.class);
-        TypeData voidType = new TypeData(typeSystem, null, context.getType(void.class), context.getType(Void.class));
+        TypeData voidType = new TypeData(typeSystem, typeSystem.getTypes().size(), null, context.getType(void.class), context.getType(Void.class));
 
         typeSystem.setGenericType(genericType);
         typeSystem.setVoidType(voidType);
@@ -151,9 +151,10 @@
         final AnnotationValue annotationValue = Utils.getAnnotationValue(typeSystem.getTemplateTypeAnnotation(), "value");
         final TypeMirror objectType = context.getType(Object.class);
 
+        int index = 0;
         for (TypeMirror primitiveType : typeMirrors) {
             TypeMirror boxedType = Utils.boxType(context, primitiveType);
-            TypeData typeData = new TypeData(typeSystem, annotationValue, primitiveType, boxedType);
+            TypeData typeData = new TypeData(typeSystem, index, annotationValue, primitiveType, boxedType);
 
             if (isPrimitiveWrapper(primitiveType)) {
                 typeData.addError("Types must not contain primitive wrapper types.");
@@ -164,11 +165,12 @@
             }
 
             types.add(typeData);
+            index++;
         }
 
         verifyTypeOrder(types);
 
-        types.add(new TypeData(typeSystem, annotationValue, objectType, objectType));
+        types.add(new TypeData(typeSystem, index, annotationValue, objectType, objectType));
 
         return types;
     }