Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/TypeData.java Mon Jul 01 21:08:20 2013 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/TypeData.java Tue Jul 02 14:51:05 2013 +0200 @@ -30,17 +30,19 @@ import com.oracle.truffle.dsl.processor.*; import com.oracle.truffle.dsl.processor.template.*; -public class TypeData extends MessageContainer { +public class TypeData extends MessageContainer implements Comparable<TypeData> { private final TypeSystemData typeSystem; private final AnnotationValue annotationValue; private final TypeMirror primitiveType; private final TypeMirror boxedType; + private final int index; private final List<TypeCastData> typeCasts = new ArrayList<>(); private final List<TypeCheckData> typeChecks = new ArrayList<>(); - public TypeData(TypeSystemData typeSystem, AnnotationValue value, TypeMirror primitiveType, TypeMirror boxedType) { + public TypeData(TypeSystemData typeSystem, int index, AnnotationValue value, TypeMirror primitiveType, TypeMirror boxedType) { + this.index = index; this.typeSystem = typeSystem; this.annotationValue = value; this.primitiveType = primitiveType; @@ -101,6 +103,13 @@ return Utils.typeEquals(boxedType, getTypeSystem().getVoidType().getBoxedType()); } + public int compareTo(TypeData o) { + if (this.equals(o)) { + return 0; + } + return index - o.index; + } + @Override public String toString() { return getClass().getSimpleName() + "[" + Utils.getSimpleName(primitiveType) + "]";