Mercurial > hg > truffle
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/SpecializationData.java @ 13527:25ecb47a6d0e
Truffle-DSL: Added support for references to child arrays in @ShortCircuit;
Introduced new layer NodeExecutionData to the implementation model which is in between NodeChildData and the actual parameters..
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 07 Jan 2014 12:22:47 +0100 |
parents | 2b9fcffd6f36 |
children | 5a0c694ef735 |
comparison
equal
deleted
inserted
replaced
13483:37ec2cabf397 | 13527:25ecb47a6d0e |
---|---|
97 } | 97 } |
98 if (hasRewrite(context)) { | 98 if (hasRewrite(context)) { |
99 return false; | 99 return false; |
100 } | 100 } |
101 | 101 |
102 for (ActualParameter parameter : getParameters()) { | 102 for (ActualParameter parameter : getSignatureParameters()) { |
103 if (!parameter.getSpecification().isSignature()) { | |
104 continue; | |
105 } | |
106 NodeChildData child = getNode().findChild(parameter.getSpecification().getName()); | |
107 if (child == null) { | |
108 continue; | |
109 } | |
110 ActualParameter genericParameter = getNode().getGenericSpecialization().findParameter(parameter.getLocalName()); | 103 ActualParameter genericParameter = getNode().getGenericSpecialization().findParameter(parameter.getLocalName()); |
111 if (!parameter.getTypeSystemType().equals(genericParameter.getTypeSystemType())) { | 104 if (!parameter.getTypeSystemType().equals(genericParameter.getTypeSystemType())) { |
112 return false; | 105 return false; |
113 } | 106 } |
114 } | 107 } |
115 | |
116 return true; | 108 return true; |
117 } | 109 } |
118 | 110 |
119 public boolean hasRewrite(ProcessorContext context) { | 111 public boolean hasRewrite(ProcessorContext context) { |
120 if (!getExceptions().isEmpty()) { | 112 if (!getExceptions().isEmpty()) { |
124 return true; | 116 return true; |
125 } | 117 } |
126 if (!getAssumptions().isEmpty()) { | 118 if (!getAssumptions().isEmpty()) { |
127 return true; | 119 return true; |
128 } | 120 } |
129 for (ActualParameter parameter : getParameters()) { | 121 for (ActualParameter parameter : getSignatureParameters()) { |
130 NodeChildData child = getNode().findChild(parameter.getSpecification().getName()); | 122 ExecutableTypeData type = parameter.getSpecification().getExecution().getChild().findExecutableType(context, parameter.getTypeSystemType()); |
131 if (child == null) { | |
132 continue; | |
133 } | |
134 ExecutableTypeData type = child.findExecutableType(context, parameter.getTypeSystemType()); | |
135 if (type.hasUnexpectedValue(context)) { | 123 if (type.hasUnexpectedValue(context)) { |
136 return true; | 124 return true; |
137 } | 125 } |
138 if (type.getReturnType().getTypeSystemType().needsCastTo(context, parameter.getTypeSystemType())) { | 126 if (type.getReturnType().getTypeSystemType().needsCastTo(context, parameter.getTypeSystemType())) { |
139 return true; | 127 return true; |
252 return !getGuards().isEmpty(); | 240 return !getGuards().isEmpty(); |
253 } | 241 } |
254 | 242 |
255 @Override | 243 @Override |
256 public String toString() { | 244 public String toString() { |
257 return String.format("%s [id = %s, method = %s, guards = %s, signature = %s]", getClass().getSimpleName(), getId(), getMethod(), getGuards(), getSignature()); | 245 return String.format("%s [id = %s, method = %s, guards = %s, signature = %s]", getClass().getSimpleName(), getId(), getMethod(), getGuards(), getTypeSignature()); |
258 } | 246 } |
259 | 247 |
260 public void forceFrame(TypeMirror frameType) { | 248 public void forceFrame(TypeMirror frameType) { |
261 if (getParameters().isEmpty() || !Utils.typeEquals(getParameters().get(0).getType(), frameType)) { | 249 if (getParameters().isEmpty() || !Utils.typeEquals(getParameters().get(0).getType(), frameType)) { |
262 ParameterSpec frameSpec = getSpecification().findParameterSpec("frame"); | 250 ParameterSpec frameSpec = getSpecification().findParameterSpec("frame"); |
265 } | 253 } |
266 } | 254 } |
267 } | 255 } |
268 | 256 |
269 public boolean equalsGuards(SpecializationData specialization) { | 257 public boolean equalsGuards(SpecializationData specialization) { |
270 if (assumptions.equals(specialization.getAssumptions()) && guards.equals(specialization.getGuards()) && getSignature().equalsParameters(specialization.getSignature())) { | 258 if (assumptions.equals(specialization.getAssumptions()) && guards.equals(specialization.getGuards()) && getTypeSignature().equalsParameters(specialization.getTypeSignature())) { |
271 return true; | 259 return true; |
272 } | 260 } |
273 return false; | 261 return false; |
274 } | 262 } |
275 | 263 |
279 return true; | 267 return true; |
280 } | 268 } |
281 } | 269 } |
282 return false; | 270 return false; |
283 } | 271 } |
272 | |
284 } | 273 } |