Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationData.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 | 97ad6d3e7557 |
children | 8e3a1635cc9e |
comparison
equal
deleted
inserted
replaced
9276:a9cfbe03d9c4 | 9279:2a4b57f02fb4 |
---|---|
34 private final int order; | 34 private final int order; |
35 private final boolean generic; | 35 private final boolean generic; |
36 private final boolean uninitialized; | 36 private final boolean uninitialized; |
37 private final List<SpecializationThrowsData> exceptions; | 37 private final List<SpecializationThrowsData> exceptions; |
38 private List<String> guardDefinitions = Collections.emptyList(); | 38 private List<String> guardDefinitions = Collections.emptyList(); |
39 private List<GuardData> guards; | 39 private List<GuardData> guards = Collections.emptyList(); |
40 private List<ShortCircuitData> shortCircuits; | 40 private List<ShortCircuitData> shortCircuits; |
41 private List<String> assumptions = Collections.emptyList(); | |
41 private boolean useSpecializationsForGeneric = true; | 42 private boolean useSpecializationsForGeneric = true; |
42 private NodeData node; | 43 private NodeData node; |
43 | 44 |
44 public SpecializationData(TemplateMethod template, int order, List<SpecializationThrowsData> exceptions) { | 45 public SpecializationData(TemplateMethod template, int order, List<SpecializationThrowsData> exceptions) { |
45 super(template); | 46 super(template); |
57 super(template); | 58 super(template); |
58 this.order = Specialization.DEFAULT_ORDER; | 59 this.order = Specialization.DEFAULT_ORDER; |
59 this.generic = generic; | 60 this.generic = generic; |
60 this.uninitialized = uninitialized; | 61 this.uninitialized = uninitialized; |
61 this.exceptions = Collections.emptyList(); | 62 this.exceptions = Collections.emptyList(); |
62 this.guards = new ArrayList<>(); | |
63 } | 63 } |
64 | 64 |
65 @Override | 65 @Override |
66 protected List<MessageContainer> findChildContainers() { | 66 protected List<MessageContainer> findChildContainers() { |
67 List<MessageContainer> sinks = new ArrayList<>(); | 67 List<MessageContainer> sinks = new ArrayList<>(); |
77 public boolean hasRewrite(ProcessorContext context) { | 77 public boolean hasRewrite(ProcessorContext context) { |
78 if (!getExceptions().isEmpty()) { | 78 if (!getExceptions().isEmpty()) { |
79 return true; | 79 return true; |
80 } | 80 } |
81 if (!getGuards().isEmpty()) { | 81 if (!getGuards().isEmpty()) { |
82 return true; | |
83 } | |
84 if (!getAssumptions().isEmpty()) { | |
82 return true; | 85 return true; |
83 } | 86 } |
84 for (ActualParameter parameter : getParameters()) { | 87 for (ActualParameter parameter : getParameters()) { |
85 NodeChildData field = getNode().findChild(parameter.getSpecification().getName()); | 88 NodeChildData field = getNode().findChild(parameter.getSpecification().getName()); |
86 if (field == null) { | 89 if (field == null) { |
173 | 176 |
174 public boolean isUseSpecializationsForGeneric() { | 177 public boolean isUseSpecializationsForGeneric() { |
175 return useSpecializationsForGeneric; | 178 return useSpecializationsForGeneric; |
176 } | 179 } |
177 | 180 |
181 public List<String> getAssumptions() { | |
182 return assumptions; | |
183 } | |
184 | |
185 void setAssumptions(List<String> assumptions) { | |
186 this.assumptions = assumptions; | |
187 } | |
188 | |
178 public SpecializationData findNextSpecialization() { | 189 public SpecializationData findNextSpecialization() { |
179 List<SpecializationData> specializations = node.getSpecializations(); | 190 List<SpecializationData> specializations = node.getSpecializations(); |
180 for (int i = 0; i < specializations.size() - 1; i++) { | 191 for (int i = 0; i < specializations.size() - 1; i++) { |
181 if (specializations.get(i) == this) { | 192 if (specializations.get(i) == this) { |
182 return specializations.get(i + 1); | 193 return specializations.get(i + 1); |