comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleTypes.java @ 9220:97ad6d3e7557

Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
author Christian Humer <christian.humer@gmail.com>
date Sat, 20 Apr 2013 12:16:22 +0200
parents 0905d796944a
children 07f8d136a05e
comparison
equal deleted inserted replaced
9219:1964871a642d 9220:97ad6d3e7557
41 41
42 private final TypeMirror node; 42 private final TypeMirror node;
43 private final TypeMirror nodeArray; 43 private final TypeMirror nodeArray;
44 private final TypeMirror unexpectedValueException; 44 private final TypeMirror unexpectedValueException;
45 private final TypeMirror frame; 45 private final TypeMirror frame;
46 private final TypeMirror stableAnnotation; 46 private final DeclaredType childAnnotation;
47 private final TypeMirror contentStableAnnotation; 47 private final DeclaredType childrenAnnotation;
48 private final TypeMirror typeConversion; 48 private final TypeMirror typeConversion;
49 private final TypeMirror truffleIntrinsics; 49 private final TypeMirror truffleIntrinsics;
50 50
51 private final List<String> errors = new ArrayList<>(); 51 private final List<String> errors = new ArrayList<>();
52 52
53 public TruffleTypes(ProcessorContext context) { 53 public TruffleTypes(ProcessorContext context) {
54 node = getRequired(context, Node.class); 54 node = getRequired(context, Node.class);
55 nodeArray = context.getEnvironment().getTypeUtils().getArrayType(node); 55 nodeArray = context.getEnvironment().getTypeUtils().getArrayType(node);
56 unexpectedValueException = getRequired(context, UnexpectedResultException.class); 56 unexpectedValueException = getRequired(context, UnexpectedResultException.class);
57 frame = getRequired(context, VirtualFrame.class); 57 frame = getRequired(context, VirtualFrame.class);
58 stableAnnotation = getRequired(context, Child.class); 58 childAnnotation = getRequired(context, Child.class);
59 contentStableAnnotation = getRequired(context, Children.class); 59 childrenAnnotation = getRequired(context, Children.class);
60 typeConversion = getRequired(context, TypeConversion.class); 60 typeConversion = getRequired(context, TypeConversion.class);
61 truffleIntrinsics = getRequired(context, TruffleIntrinsics.class); 61 truffleIntrinsics = getRequired(context, TruffleIntrinsics.class);
62 } 62 }
63 63
64 public boolean verify(ProcessorContext context, Element element, AnnotationMirror mirror) { 64 public boolean verify(ProcessorContext context, Element element, AnnotationMirror mirror) {
71 } 71 }
72 72
73 return false; 73 return false;
74 } 74 }
75 75
76 private TypeMirror getRequired(ProcessorContext context, Class clazz) { 76 private DeclaredType getRequired(ProcessorContext context, Class clazz) {
77 TypeMirror type = context.getType(clazz); 77 TypeMirror type = context.getType(clazz);
78 if (type == null) { 78 if (type == null) {
79 errors.add(String.format("Could not find required type: %s", clazz.getSimpleName())); 79 errors.add(String.format("Could not find required type: %s", clazz.getSimpleName()));
80 } 80 }
81 return type; 81 return (DeclaredType) type;
82 } 82 }
83 83
84 public TypeMirror getTruffleIntrinsics() { 84 public TypeMirror getTruffleIntrinsics() {
85 return truffleIntrinsics; 85 return truffleIntrinsics;
86 } 86 }
103 103
104 public TypeMirror getUnexpectedValueException() { 104 public TypeMirror getUnexpectedValueException() {
105 return unexpectedValueException; 105 return unexpectedValueException;
106 } 106 }
107 107
108 public TypeMirror getStableAnnotation() { 108 public DeclaredType getChildAnnotation() {
109 return stableAnnotation; 109 return childAnnotation;
110 } 110 }
111 111
112 public TypeMirror getContentStableAnnotation() { 112 public DeclaredType getChildrenAnnotation() {
113 return contentStableAnnotation; 113 return childrenAnnotation;
114 } 114 }
115 } 115 }