comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationMethodParser.java @ 8248:c4c3f50fa9c2

Fixes for codegen builtins support.
author Christian Humer <christian.humer@gmail.com>
date Tue, 12 Mar 2013 11:37:32 +0100
parents 703c09f8640c
children 0905d796944a
comparison
equal deleted inserted replaced
8247:5b08b0f4d338 8248:c4c3f50fa9c2
53 public Class<? extends Annotation> getAnnotationType() { 53 public Class<? extends Annotation> getAnnotationType() {
54 return Specialization.class; 54 return Specialization.class;
55 } 55 }
56 56
57 private SpecializationData parseSpecialization(TemplateMethod method) { 57 private SpecializationData parseSpecialization(TemplateMethod method) {
58 int order = Utils.getAnnotationValueInt(method.getMarkerAnnotation(), "order"); 58 int order = Utils.getAnnotationValue(Integer.class, method.getMarkerAnnotation(), "order");
59 if (order < 0 && order != Specialization.DEFAULT_ORDER) { 59 if (order < 0 && order != Specialization.DEFAULT_ORDER) {
60 getContext().getLog().error(method.getMethod(), method.getMarkerAnnotation(), "Invalid order attribute %d. The value must be >= 0 or the default value."); 60 getContext().getLog().error(method.getMethod(), method.getMarkerAnnotation(), "Invalid order attribute %d. The value must be >= 0 or the default value.");
61 return null; 61 return null;
62 } 62 }
63 63
64 List<TypeMirror> exceptionTypes = Utils.getAnnotationValueList(method.getMarkerAnnotation(), "rewriteOn"); 64 List<TypeMirror> exceptionTypes = Utils.getAnnotationValueList(TypeMirror.class, method.getMarkerAnnotation(), "rewriteOn");
65 List<SpecializationThrowsData> exceptionData = new ArrayList<>(); 65 List<SpecializationThrowsData> exceptionData = new ArrayList<>();
66 for (TypeMirror exceptionType : exceptionTypes) { 66 for (TypeMirror exceptionType : exceptionTypes) {
67 exceptionData.add(new SpecializationThrowsData(method.getMarkerAnnotation(), exceptionType)); 67 exceptionData.add(new SpecializationThrowsData(method.getMarkerAnnotation(), exceptionType));
68 68
69 if (!Utils.canThrowType(method.getMethod().getThrownTypes(), exceptionType)) { 69 if (!Utils.canThrowType(method.getMethod().getThrownTypes(), exceptionType)) {
79 return Utils.compareByTypeHierarchy(o1.getJavaClass(), o2.getJavaClass()); 79 return Utils.compareByTypeHierarchy(o1.getJavaClass(), o2.getJavaClass());
80 } 80 }
81 }); 81 });
82 SpecializationData specialization = new SpecializationData(method, order, exceptionData); 82 SpecializationData specialization = new SpecializationData(method, order, exceptionData);
83 boolean valid = true; 83 boolean valid = true;
84 List<String> guardDefs = Utils.getAnnotationValueList(specialization.getMarkerAnnotation(), "guards"); 84 List<String> guardDefs = Utils.getAnnotationValueList(String.class, specialization.getMarkerAnnotation(), "guards");
85 SpecializationGuardData[] guardData = new SpecializationGuardData[guardDefs.size()]; 85 SpecializationGuardData[] guardData = new SpecializationGuardData[guardDefs.size()];
86 for (int i = 0; i < guardData.length; i++) { 86 for (int i = 0; i < guardData.length; i++) {
87 String guardMethod = guardDefs.get(i); 87 String guardMethod = guardDefs.get(i);
88 88
89 boolean onSpecialization = true; 89 boolean onSpecialization = true;