Mercurial > hg > truffle
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/SpecializationData.java @ 19293:21b9b9941775
Truffle-DSL: initialize caches late if possible; fix assumption arrays need a @CompilationFinal to be checked.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 11 Feb 2015 12:13:44 +0100 |
parents | f4792a544170 |
children | 18c0f02fa4d2 |
comparison
equal
deleted
inserted
replaced
19292:906367e494ca | 19293:21b9b9941775 |
---|---|
65 for (SpecializationThrowsData exception : exceptions) { | 65 for (SpecializationThrowsData exception : exceptions) { |
66 exception.setSpecialization(this); | 66 exception.setSpecialization(this); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 public boolean isCacheBoundByGuard(CacheExpression cacheExpression) { | |
71 for (GuardExpression expression : getGuards()) { | |
72 if (expression.getExpression().findBoundVariableElements().contains(cacheExpression.getParameter().getVariableElement())) { | |
73 return true; | |
74 } | |
75 } | |
76 | |
77 // check all next binding caches if they are bound by guard | |
78 Set<VariableElement> boundVariables = cacheExpression.getExpression().findBoundVariableElements(); | |
79 boolean found = false; | |
80 for (CacheExpression expression : getCaches()) { | |
81 if (cacheExpression == expression) { | |
82 found = true; | |
83 } else if (found) { | |
84 if (boundVariables.contains(expression.getParameter().getVariableElement())) { | |
85 if (isCacheBoundByGuard(expression)) { | |
86 return true; | |
87 } | |
88 } | |
89 } | |
90 } | |
91 return false; | |
92 } | |
93 | |
70 public boolean isDynamicParameterBound(DSLExpression expression) { | 94 public boolean isDynamicParameterBound(DSLExpression expression) { |
71 Set<VariableElement> boundVariables = expression.findBoundVariableElements(); | 95 Set<VariableElement> boundVariables = expression.findBoundVariableElements(); |
72 for (Parameter parameter : getDynamicParameters()) { | 96 for (Parameter parameter : getDynamicParameters()) { |
73 if (boundVariables.contains(parameter.getVariableElement())) { | 97 if (boundVariables.contains(parameter.getVariableElement())) { |
74 return true; | 98 return true; |