Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/NodeData.java @ 18761:a665483c3881
Truffle-DSL: new node layout implementation.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 29 Dec 2014 23:38:54 +0100 |
parents | 59bf50cc5a32 |
children | c0fb70634640 |
comparison
equal
deleted
inserted
replaced
18760:6fa3999631d8 | 18761:a665483c3881 |
---|---|
54 private final NodeExecutionData thisExecution; | 54 private final NodeExecutionData thisExecution; |
55 private final boolean generateFactory; | 55 private final boolean generateFactory; |
56 | 56 |
57 public NodeData(ProcessorContext context, TypeElement type, String shortName, TypeSystemData typeSystem, List<NodeChildData> children, List<NodeExecutionData> executions, | 57 public NodeData(ProcessorContext context, TypeElement type, String shortName, TypeSystemData typeSystem, List<NodeChildData> children, List<NodeExecutionData> executions, |
58 List<NodeFieldData> fields, List<String> assumptions, boolean generateFactory) { | 58 List<NodeFieldData> fields, List<String> assumptions, boolean generateFactory) { |
59 super(context, type, null, null); | 59 super(context, type, null); |
60 this.nodeId = type.getSimpleName().toString(); | 60 this.nodeId = type.getSimpleName().toString(); |
61 this.shortName = shortName; | 61 this.shortName = shortName; |
62 this.typeSystem = typeSystem; | 62 this.typeSystem = typeSystem; |
63 this.fields = fields; | 63 this.fields = fields; |
64 this.children = children; | 64 this.children = children; |
96 | 96 |
97 public List<NodeExecutionData> getChildExecutions() { | 97 public List<NodeExecutionData> getChildExecutions() { |
98 return childExecutions; | 98 return childExecutions; |
99 } | 99 } |
100 | 100 |
101 public Set<TypeData> findSpecializedTypes(NodeExecutionData execution) { | |
102 Set<TypeData> types = new HashSet<>(); | |
103 for (SpecializationData specialization : getSpecializations()) { | |
104 if (!specialization.isSpecialized()) { | |
105 continue; | |
106 } | |
107 List<Parameter> parameters = specialization.findByExecutionData(execution); | |
108 for (Parameter parameter : parameters) { | |
109 TypeData type = parameter.getTypeSystemType(); | |
110 if (type == null) { | |
111 throw new AssertionError(); | |
112 } | |
113 types.add(type); | |
114 } | |
115 } | |
116 return types; | |
117 } | |
118 | |
119 public Collection<TypeData> findSpecializedReturnTypes() { | |
120 Set<TypeData> types = new HashSet<>(); | |
121 for (SpecializationData specialization : getSpecializations()) { | |
122 if (!specialization.isSpecialized()) { | |
123 continue; | |
124 } | |
125 types.add(specialization.getReturnType().getTypeSystemType()); | |
126 } | |
127 return types; | |
128 } | |
129 | |
101 public int getSignatureSize() { | 130 public int getSignatureSize() { |
102 if (getSpecializations() != null && !getSpecializations().isEmpty()) { | 131 if (getSpecializations() != null && !getSpecializations().isEmpty()) { |
103 return getSpecializations().get(0).getSignatureSize(); | 132 return getSpecializations().get(0).getSignatureSize(); |
104 } | 133 } |
105 return 0; | 134 return 0; |
351 return null; | 380 return null; |
352 } | 381 } |
353 | 382 |
354 public SpecializationData getGenericSpecialization() { | 383 public SpecializationData getGenericSpecialization() { |
355 for (SpecializationData specialization : specializations) { | 384 for (SpecializationData specialization : specializations) { |
356 if (specialization.isGeneric()) { | 385 if (specialization.isFallback()) { |
357 return specialization; | 386 return specialization; |
358 } | 387 } |
359 } | 388 } |
360 return null; | 389 return null; |
361 } | 390 } |