comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeParser.java @ 9279:2a4b57f02fb4

Implemented basic support for assumptions for sourcecode generation.
author Christian Humer <christian.humer@gmail.com>
date Wed, 24 Apr 2013 17:44:15 +0200
parents 6d92fdf1c999
children 39f08ef7b5d8
comparison
equal deleted inserted replaced
9276:a9cfbe03d9c4 9279:2a4b57f02fb4
560 AnnotationMirror nodeClass = findFirstAnnotation(lookupTypes, NodeClass.class); 560 AnnotationMirror nodeClass = findFirstAnnotation(lookupTypes, NodeClass.class);
561 if (nodeClass != null) { 561 if (nodeClass != null) {
562 splitByMethodName = Utils.getAnnotationValue(Boolean.class, nodeClass, "splitByMethodName"); 562 splitByMethodName = Utils.getAnnotationValue(Boolean.class, nodeClass, "splitByMethodName");
563 } 563 }
564 564
565 List<String> assumptionsList = new ArrayList<>();
566
567 for (int i = lookupTypes.size() - 1; i >= 0; i--) {
568 TypeElement type = lookupTypes.get(i);
569 AnnotationMirror assumptions = Utils.findAnnotationMirror(context.getEnvironment(), type, NodeAssumptions.class);
570 if (assumptions != null) {
571 List<String> assumptionStrings = Utils.getAnnotationValueList(String.class, assumptions, "value");
572 for (String string : assumptionStrings) {
573 if (assumptionsList.contains(string)) {
574 assumptionsList.remove(string);
575 }
576 assumptionsList.add(string);
577 }
578 }
579 }
580 nodeData.setAssumptions(new ArrayList<>(assumptionsList));
565 nodeData.setNodeType(nodeType); 581 nodeData.setNodeType(nodeType);
566 nodeData.setSplitByMethodName(splitByMethodName); 582 nodeData.setSplitByMethodName(splitByMethodName);
567 nodeData.setTypeSystem(typeSystem); 583 nodeData.setTypeSystem(typeSystem);
568 nodeData.setFields(parseFields(elements)); 584 nodeData.setFields(parseFields(elements));
569 nodeData.setExecutableTypes(groupExecutableTypes(new ExecutableTypeMethodParser(context, nodeData).parse(elements))); 585 nodeData.setExecutableTypes(groupExecutableTypes(new ExecutableTypeMethodParser(context, nodeData).parse(elements)));