Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java @ 7502:6343a09b2ec1
Codegen operation generation is inferred from the node type hierarchy.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 18 Jan 2013 13:28:12 +0100 |
parents | a748e4d44694 |
children | 5e3d1a68664e |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java Thu Jan 17 17:21:16 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java Fri Jan 18 13:28:12 2013 +0100 @@ -36,22 +36,17 @@ private final TypeMirror[] primitiveTypeMirrors; private final TypeMirror[] boxedTypeMirrors; - private final TypeMirror nodeType; private final TypeMirror genericType; private final TypeData voidType; - private List<GuardData> guards; - public TypeSystemData(TypeElement templateType, AnnotationMirror annotation, - TypeData[] types, TypeMirror nodeType, TypeMirror genericType, TypeData voidType) { + TypeData[] types, TypeMirror genericType, TypeData voidType) { super(templateType, annotation); - this.voidType = voidType; this.types = types; - this.nodeType = nodeType; this.genericType = genericType; - + this.voidType = voidType; this.primitiveTypeMirrors = new TypeMirror[types.length]; for (int i = 0; i < types.length; i++) { primitiveTypeMirrors[i] = types[i].getPrimitiveType(); @@ -70,16 +65,12 @@ } } - public TypeData getVoidType() { - return voidType; + public boolean isGeneric(TypeMirror type) { + return Utils.typeEquals(getGenericType(), type); } - void setGuards(List<GuardData> guards) { - this.guards = guards; - } - - public List<GuardData> getGuards() { - return guards; + public TypeData getVoidType() { + return voidType; } public TypeData[] getTypes() { @@ -94,10 +85,6 @@ return boxedTypeMirrors; } - public TypeMirror getNodeType() { - return nodeType; - } - public TypeMirror getGenericType() { return genericType; } @@ -116,6 +103,18 @@ } return null; } + public TypeData findTypeData(TypeMirror type) { + if (Utils.typeEquals(voidType.getPrimitiveType(), type)) { + return voidType; + } + + int index = findType(type); + if (index == -1) { + return null; + } + return types[index]; + } + public int findType(TypeMirror type) { for (int i = 0; i < types.length; i++) { @@ -126,4 +125,11 @@ return -1; } + + @Override + public String toString() { + return getClass().getSimpleName() + "[template = " + Utils.getSimpleName(getTemplateType()) + ", types = " + Arrays.toString(types) + "]"; + } + + }