comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationMethodParser.java @ 8310:89006c76f737

Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
author Christian Humer <christian.humer@gmail.com>
date Fri, 15 Mar 2013 21:18:33 +0100
parents 0905d796944a
children a80bf36c6a1e
comparison
equal deleted inserted replaced
8280:2ddf84436009 8310:89006c76f737
78 public int compare(SpecializationThrowsData o1, SpecializationThrowsData o2) { 78 public int compare(SpecializationThrowsData o1, SpecializationThrowsData o2) {
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;
84 AnnotationValue guardsValue = Utils.getAnnotationValue(method.getMarkerAnnotation(), "guards"); 83 AnnotationValue guardsValue = Utils.getAnnotationValue(method.getMarkerAnnotation(), "guards");
85 List<String> guardDefs = Utils.getAnnotationValueList(String.class, specialization.getMarkerAnnotation(), "guards"); 84 List<String> guardDefs = Utils.getAnnotationValueList(String.class, specialization.getMarkerAnnotation(), "guards");
86 List<SpecializationGuardData> guardData = new ArrayList<>(guardDefs.size()); 85 List<SpecializationGuardData> guardData = new ArrayList<>(guardDefs.size());
87 for (int i = 0; i < guardDefs.size(); i++) { 86 for (int i = 0; i < guardDefs.size(); i++) {
88 String guardMethod = guardDefs.get(i); 87 String guardMethod = guardDefs.get(i);
92 guardData.add(assignedGuard); 91 guardData.add(assignedGuard);
93 92
94 GuardData compatibleGuard = matchSpecializationGuard(specialization, assignedGuard); 93 GuardData compatibleGuard = matchSpecializationGuard(specialization, assignedGuard);
95 if (compatibleGuard != null) { 94 if (compatibleGuard != null) {
96 assignedGuard.setGuardDeclaration(compatibleGuard); 95 assignedGuard.setGuardDeclaration(compatibleGuard);
97 } else {
98 valid = false;
99 } 96 }
100 }
101
102 if (!valid) {
103 return null;
104 } 97 }
105 98
106 specialization.setGuards(guardData); 99 specialization.setGuards(guardData);
107 100
108 return specialization; 101 return specialization;