Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/SpecializationMethodParser.java @ 16755:bd28da642eea
Truffle-DSL: Several new features implemented:
Implementation of a new code generation layout which shares code between generated nodes.
Declaration order of specializations is now used as specialization order.
Specializations do no longer perform fallthrough on respecialization, they now always respecialize from the first specialization.
Implemented support for contains relations between specializations.
Improved reachability error messages.
Preliminary support for @Implies.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 11 Aug 2014 15:53:05 +0200 |
parents | 5a0c694ef735 |
children |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/SpecializationMethodParser.java Mon Aug 11 15:53:05 2014 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/SpecializationMethodParser.java Mon Aug 11 15:53:05 2014 +0200 @@ -32,6 +32,7 @@ import com.oracle.truffle.dsl.processor.*; import com.oracle.truffle.dsl.processor.node.SpecializationData.SpecializationKind; import com.oracle.truffle.dsl.processor.template.*; +import com.oracle.truffle.dsl.processor.typesystem.*; public class SpecializationMethodParser extends NodeMethodParser<SpecializationData> { @@ -55,11 +56,6 @@ } private SpecializationData parseSpecialization(TemplateMethod method) { - int order = Utils.getAnnotationValue(Integer.class, method.getMarkerAnnotation(), "order"); - if (order < 0 && order != Specialization.DEFAULT_ORDER) { - method.addError("Invalid order attribute %d. The value must be >= 0 or the default value."); - } - AnnotationValue rewriteValue = Utils.getAnnotationValue(method.getMarkerAnnotation(), "rewriteOn"); List<TypeMirror> exceptionTypes = Utils.getAnnotationValueList(TypeMirror.class, method.getMarkerAnnotation(), "rewriteOn"); List<SpecializationThrowsData> exceptionData = new ArrayList<>(); @@ -78,9 +74,34 @@ return Utils.compareByTypeHierarchy(o1.getJavaClass(), o2.getJavaClass()); } }); - SpecializationData specialization = new SpecializationData(getNode(), method, SpecializationKind.SPECIALIZED, order, exceptionData); + SpecializationData specialization = new SpecializationData(getNode(), method, SpecializationKind.SPECIALIZED, exceptionData); + + String insertBeforeName = Utils.getAnnotationValue(String.class, method.getMarkerAnnotation(), "insertBefore"); + if (!insertBeforeName.equals("")) { + specialization.setInsertBeforeName(insertBeforeName); + } + List<String> guardDefs = Utils.getAnnotationValueList(String.class, specialization.getMarkerAnnotation(), "guards"); - specialization.setGuardDefinitions(guardDefs); + List<GuardExpression> guardExpressions = new ArrayList<>(); + for (String guardDef : guardDefs) { + guardExpressions.add(new GuardExpression(guardDef)); + } + specialization.setGuards(guardExpressions); + + List<String> containsDefs = Utils.getAnnotationValueList(String.class, specialization.getMarkerAnnotation(), "contains"); + Set<String> containsNames = specialization.getContainsNames(); + containsNames.clear(); + if (containsDefs != null) { + for (String include : containsDefs) { + if (!containsNames.contains(include)) { + specialization.getContainsNames().add(include); + } else { + AnnotationValue value = Utils.getAnnotationValue(specialization.getMarkerAnnotation(), "contains"); + specialization.addError(value, "Duplicate contains declaration '%s'.", include); + } + } + + } List<String> assumptionDefs = Utils.getAnnotationValueList(String.class, specialization.getMarkerAnnotation(), "assumptions"); specialization.setAssumptions(assumptionDefs);