Mercurial > hg > truffle
diff truffle/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/SpecializationData.java @ 22348:dbbcd8eb5dae
Truffle DSL: fix algorithm to find guard dependencies on caches
author | Benoit Daloze <benoit.daloze@jku.at> |
---|---|
date | Thu, 05 Nov 2015 17:05:48 +0100 |
parents | dc83cc1f94f2 |
children |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/SpecializationData.java Thu Nov 05 16:11:50 2015 +0100 +++ b/truffle/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/SpecializationData.java Thu Nov 05 17:05:48 2015 +0100 @@ -72,20 +72,21 @@ } public boolean isCacheBoundByGuard(CacheExpression cacheExpression) { + VariableElement cachedVariable = cacheExpression.getParameter().getVariableElement(); + for (GuardExpression expression : getGuards()) { - if (expression.getExpression().findBoundVariableElements().contains(cacheExpression.getParameter().getVariableElement())) { + if (expression.getExpression().findBoundVariableElements().contains(cachedVariable)) { return true; } } - // check all next binding caches if they are bound by guard - Set<VariableElement> boundVariables = cacheExpression.getExpression().findBoundVariableElements(); + // check all next binding caches if they are bound to a guard and use this cache variable boolean found = false; for (CacheExpression expression : getCaches()) { if (cacheExpression == expression) { found = true; } else if (found) { - if (boundVariables.contains(expression.getParameter().getVariableElement())) { + if (expression.getExpression().findBoundVariableElements().contains(cachedVariable)) { if (isCacheBoundByGuard(expression)) { return true; }