Mercurial > hg > truffle
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/SpecializationGroup.java @ 19289:62c43fcf5be2
Truffle-DSL: implement @Cached and fixes for the new guard expression syntax.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 03 Feb 2015 15:07:07 +0100 |
parents | 08aa0372dad4 |
children | f4792a544170 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/SpecializationGroup.java Mon Dec 29 18:32:03 2014 +0100 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/SpecializationGroup.java Tue Feb 03 15:07:07 2015 +0100 @@ -24,7 +24,6 @@ import java.util.*; -import com.oracle.truffle.dsl.processor.generator.*; import com.oracle.truffle.dsl.processor.model.*; import com.oracle.truffle.dsl.processor.model.TemplateMethod.TypeSignature; @@ -108,10 +107,6 @@ return null; } - if (previous.mayBeExcluded()) { - return null; - } - /* Guard is else branch can be connected in previous specialization. */ if (elseConnectedGuards.contains(guard)) { return guard; @@ -124,19 +119,6 @@ return null; } - private boolean mayBeExcluded() { - if (specialization != null) { - return NodeGenFactory.mayBeExcluded(specialization); - } else { - for (SpecializationGroup group : getChildren()) { - if (group.mayBeExcluded()) { - return true; - } - } - } - return false; - } - private void updateChildren(List<SpecializationGroup> childs) { if (!children.isEmpty()) { children.clear(); @@ -381,4 +363,16 @@ } } + public SpecializationGroup getPrevious() { + if (getParent() == null) { + return null; + } + + List<SpecializationGroup> parentChildren = getParent().getChildren(); + int index = parentChildren.indexOf(this); + if (index <= 0) { + return null; + } + return parentChildren.get(index - 1); + } }