Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java @ 7752:388848bbe03d
Fixed resolve of generic execute type.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 08 Feb 2013 16:23:11 +0100 |
parents | 5f3cba05c2fa |
children | 3cec97eb3b5f |
comparison
equal
deleted
inserted
replaced
7751:ef1b41ea0a90 | 7752:388848bbe03d |
---|---|
128 | 128 |
129 public ExecutableTypeData findGenericExecutableType(ProcessorContext context) { | 129 public ExecutableTypeData findGenericExecutableType(ProcessorContext context) { |
130 List<ExecutableTypeData> types = findGenericExecutableTypes(context); | 130 List<ExecutableTypeData> types = findGenericExecutableTypes(context); |
131 if (types.size() == 1) { | 131 if (types.size() == 1) { |
132 return types.get(0); | 132 return types.get(0); |
133 } else { | 133 } else if (types.size() == 2) { |
134 ExecutableTypeData execType = null; | 134 if (types.get(0).getType().isVoid()) { |
135 for (ExecutableTypeData type : types) { | 135 return types.get(1); |
136 TypeData returnType = type.getReturnType().getActualTypeData(getTypeSystem()); | 136 } else if (types.get(1).getType().isVoid()) { |
137 if (!returnType.isVoid()) { | 137 return types.get(0); |
138 if (execType != null) { | 138 } |
139 // multiple generic types not allowed | 139 } |
140 return null; | 140 |
141 } | 141 ExecutableTypeData execType = null; |
142 execType = type; | 142 for (ExecutableTypeData type : types) { |
143 TypeData returnType = type.getReturnType().getActualTypeData(getTypeSystem()); | |
144 if (returnType.isGeneric()) { | |
145 if (execType != null) { | |
146 return null; | |
143 } | 147 } |
144 } | 148 execType = type; |
145 return execType; | 149 } |
146 } | 150 } |
151 return execType; | |
147 } | 152 } |
148 | 153 |
149 private List<ExecutableTypeData> findGenericExecutableTypes(ProcessorContext context) { | 154 private List<ExecutableTypeData> findGenericExecutableTypes(ProcessorContext context) { |
150 List<ExecutableTypeData> types = new ArrayList<>(); | 155 List<ExecutableTypeData> types = new ArrayList<>(); |
151 for (ExecutableTypeData type : executableTypes) { | 156 for (ExecutableTypeData type : executableTypes) { |