comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/SpecializationData.java @ 20938:18c0f02fa4d2

Truffle-DSL: make type systems optional.
author Christian Humer <christian.humer@gmail.com>
date Tue, 14 Apr 2015 15:12:48 +0200
parents 21b9b9941775
children 476374f3fe9a
comparison
equal deleted inserted replaced
20937:37ea76052733 20938:18c0f02fa4d2
23 package com.oracle.truffle.dsl.processor.model; 23 package com.oracle.truffle.dsl.processor.model;
24 24
25 import java.util.*; 25 import java.util.*;
26 26
27 import javax.lang.model.element.*; 27 import javax.lang.model.element.*;
28 import javax.lang.model.type.*;
28 29
29 import com.oracle.truffle.dsl.processor.*; 30 import com.oracle.truffle.dsl.processor.*;
30 import com.oracle.truffle.dsl.processor.expression.*; 31 import com.oracle.truffle.dsl.processor.expression.*;
31 import com.oracle.truffle.dsl.processor.java.*; 32 import com.oracle.truffle.dsl.processor.java.*;
32 33
199 return true; 200 return true;
200 } 201 }
201 202
202 for (Parameter parameter : getSignatureParameters()) { 203 for (Parameter parameter : getSignatureParameters()) {
203 NodeChildData child = parameter.getSpecification().getExecution().getChild(); 204 NodeChildData child = parameter.getSpecification().getExecution().getChild();
204 ExecutableTypeData type = child.findExecutableType(parameter.getTypeSystemType()); 205 if (child != null) {
205 if (type == null) { 206 ExecutableTypeData type = child.findExecutableType(parameter.getType());
206 type = child.findAnyGenericExecutableType(context); 207 if (type == null) {
207 } 208 type = child.findAnyGenericExecutableType(context);
208 if (type.hasUnexpectedValue(context)) { 209 }
209 return true; 210 if (type.hasUnexpectedValue(context)) {
210 } 211 return true;
211 if (type.getReturnType().getTypeSystemType().needsCastTo(parameter.getTypeSystemType())) { 212 }
212 return true; 213 if (ElementUtils.needsCastTo(type.getReturnType(), parameter.getType())) {
213 } 214 return true;
214 215 }
216 }
215 } 217 }
216 return false; 218 return false;
217 } 219 }
218 220
219 @Override 221 @Override
354 } 356 }
355 357
356 Iterator<Parameter> currentSignature = getSignatureParameters().iterator(); 358 Iterator<Parameter> currentSignature = getSignatureParameters().iterator();
357 Iterator<Parameter> prevSignature = prev.getSignatureParameters().iterator(); 359 Iterator<Parameter> prevSignature = prev.getSignatureParameters().iterator();
358 360
361 TypeSystemData typeSystem = prev.getNode().getTypeSystem();
359 while (currentSignature.hasNext() && prevSignature.hasNext()) { 362 while (currentSignature.hasNext() && prevSignature.hasNext()) {
360 TypeData currentType = currentSignature.next().getTypeSystemType(); 363 TypeMirror currentType = currentSignature.next().getType();
361 TypeData prevType = prevSignature.next().getTypeSystemType(); 364 TypeMirror prevType = prevSignature.next().getType();
362 365
363 if (!currentType.isImplicitSubtypeOf(prevType)) { 366 if (!typeSystem.isImplicitSubtypeOf(currentType, prevType)) {
364 return true; 367 return true;
365 } 368 }
366 } 369 }
367 370
368 if (!prev.getAssumptionExpressions().isEmpty()) { 371 if (!prev.getAssumptionExpressions().isEmpty()) {