comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/CreateCastParser.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 43eab069ca9b
children b466199f19e1
comparison
equal deleted inserted replaced
13483:37ec2cabf397 13527:25ecb47a6d0e
44 } 44 }
45 45
46 @Override 46 @Override
47 public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) { 47 public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
48 List<String> childNames = Utils.getAnnotationValueList(String.class, mirror, "value"); 48 List<String> childNames = Utils.getAnnotationValueList(String.class, mirror, "value");
49 TypeMirror baseType = getContext().getTruffleTypes().getNode(); 49 NodeChildData foundChild = null;
50 for (String childName : childNames) { 50 for (String childName : childNames) {
51 NodeChildData child = getNode().findChild(childName); 51 foundChild = getNode().findChild(childName);
52 if (child != null) { 52 if (foundChild != null) {
53 baseType = child.getOriginalType();
54 break; 53 break;
55 } 54 }
56 } 55 }
56 TypeMirror baseType = getContext().getTruffleTypes().getNode();
57 if (foundChild != null) {
58 baseType = foundChild.getOriginalType();
59 }
60
57 MethodSpec spec = new MethodSpec(new InheritsParameterSpec(getContext(), "child", baseType)); 61 MethodSpec spec = new MethodSpec(new InheritsParameterSpec(getContext(), "child", baseType));
58 addDefaultFieldMethodSpec(spec); 62 addDefaultFieldMethodSpec(spec);
59 spec.addRequired(new ParameterSpec("castedChild", baseType)).setSignature(true); 63 spec.addRequired(new ParameterSpec("castedChild", baseType));
60 return spec; 64 return spec;
61 } 65 }
62 66
63 @Override 67 @Override
64 public CreateCastData create(TemplateMethod method, boolean invalid) { 68 public CreateCastData create(TemplateMethod method, boolean invalid) {