comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/TypeData.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 efe58aa92f86
comparison
equal deleted inserted replaced
10599:ebf5c5c23564 10600:e93efe3ba5f4
28 import javax.lang.model.type.*; 28 import javax.lang.model.type.*;
29 29
30 import com.oracle.truffle.dsl.processor.*; 30 import com.oracle.truffle.dsl.processor.*;
31 import com.oracle.truffle.dsl.processor.template.*; 31 import com.oracle.truffle.dsl.processor.template.*;
32 32
33 public class TypeData extends MessageContainer { 33 public class TypeData extends MessageContainer implements Comparable<TypeData> {
34 34
35 private final TypeSystemData typeSystem; 35 private final TypeSystemData typeSystem;
36 private final AnnotationValue annotationValue; 36 private final AnnotationValue annotationValue;
37 private final TypeMirror primitiveType; 37 private final TypeMirror primitiveType;
38 private final TypeMirror boxedType; 38 private final TypeMirror boxedType;
39 39
40 private final int index;
40 private final List<TypeCastData> typeCasts = new ArrayList<>(); 41 private final List<TypeCastData> typeCasts = new ArrayList<>();
41 private final List<TypeCheckData> typeChecks = new ArrayList<>(); 42 private final List<TypeCheckData> typeChecks = new ArrayList<>();
42 43
43 public TypeData(TypeSystemData typeSystem, AnnotationValue value, TypeMirror primitiveType, TypeMirror boxedType) { 44 public TypeData(TypeSystemData typeSystem, int index, AnnotationValue value, TypeMirror primitiveType, TypeMirror boxedType) {
45 this.index = index;
44 this.typeSystem = typeSystem; 46 this.typeSystem = typeSystem;
45 this.annotationValue = value; 47 this.annotationValue = value;
46 this.primitiveType = primitiveType; 48 this.primitiveType = primitiveType;
47 this.boxedType = boxedType; 49 this.boxedType = boxedType;
48 } 50 }
99 return false; 101 return false;
100 } 102 }
101 return Utils.typeEquals(boxedType, getTypeSystem().getVoidType().getBoxedType()); 103 return Utils.typeEquals(boxedType, getTypeSystem().getVoidType().getBoxedType());
102 } 104 }
103 105
106 public int compareTo(TypeData o) {
107 if (this.equals(o)) {
108 return 0;
109 }
110 return index - o.index;
111 }
112
104 @Override 113 @Override
105 public String toString() { 114 public String toString() {
106 return getClass().getSimpleName() + "[" + Utils.getSimpleName(primitiveType) + "]"; 115 return getClass().getSimpleName() + "[" + Utils.getSimpleName(primitiveType) + "]";
107 } 116 }
108 117