Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeBaseFactory.java @ 18775:a069a87b9a02
Truffle-DSL: Added tests and verification of overridable generic execute methods.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 05 Jan 2015 01:31:08 +0100 |
parents | a720bf2e2f43 |
children | c0fb70634640 |
comparison
equal
deleted
inserted
replaced
18774:674c8a6d5e6c | 18775:a069a87b9a02 |
---|---|
1168 } | 1168 } |
1169 return builder.build(); | 1169 return builder.build(); |
1170 } | 1170 } |
1171 | 1171 |
1172 private ExecutableTypeData resolveExecutableType(NodeExecutionData execution, TypeData type) { | 1172 private ExecutableTypeData resolveExecutableType(NodeExecutionData execution, TypeData type) { |
1173 ExecutableTypeData targetExecutable = execution.getChild().findExecutableType(context, type); | 1173 ExecutableTypeData targetExecutable = execution.getChild().findExecutableType(type); |
1174 if (targetExecutable == null) { | 1174 if (targetExecutable == null) { |
1175 targetExecutable = execution.getChild().findAnyGenericExecutableType(context); | 1175 targetExecutable = execution.getChild().findAnyGenericExecutableType(context); |
1176 } | 1176 } |
1177 return targetExecutable; | 1177 return targetExecutable; |
1178 } | 1178 } |
1341 builder.startBlock(); | 1341 builder.startBlock(); |
1342 } else { | 1342 } else { |
1343 builder.startElseBlock(); | 1343 builder.startElseBlock(); |
1344 } | 1344 } |
1345 | 1345 |
1346 ExecutableTypeData implictExecutableTypeData = execution.getChild().findExecutableType(context, sourceType); | 1346 ExecutableTypeData implictExecutableTypeData = execution.getChild().findExecutableType(sourceType); |
1347 if (implictExecutableTypeData == null) { | 1347 if (implictExecutableTypeData == null) { |
1348 /* | 1348 /* |
1349 * For children with executeWith.size() > 0 an executable type may not exist so use | 1349 * For children with executeWith.size() > 0 an executable type may not exist so use |
1350 * the generic executable type which is guaranteed to exist. An expect call is | 1350 * the generic executable type which is guaranteed to exist. An expect call is |
1351 * inserted automatically by #createExecuteExpression. | 1351 * inserted automatically by #createExecuteExpression. |
1352 */ | 1352 */ |
1353 implictExecutableTypeData = execution.getChild().getNodeData().findExecutableType(node.getTypeSystem().getGenericTypeData(), execution.getChild().getExecuteWith().size()); | 1353 implictExecutableTypeData = execution.getChild().getNodeData().findAnyGenericExecutableType(context, execution.getChild().getExecuteWith().size()); |
1354 } | 1354 } |
1355 | 1355 |
1356 ImplicitCastData cast = execution.getChild().getNodeData().getTypeSystem().lookupCast(sourceType, targetParameter.getTypeSystemType()); | 1356 ImplicitCastData cast = execution.getChild().getNodeData().getTypeSystem().lookupCast(sourceType, targetParameter.getTypeSystemType()); |
1357 CodeTree execute = createExecuteChildExpression(builder, execution, expectType, targetParameter, null, cast); | 1357 CodeTree execute = createExecuteChildExpression(builder, execution, expectType, targetParameter, null, cast); |
1358 builder.statement(execute); | 1358 builder.statement(execute); |
1836 } | 1836 } |
1837 | 1837 |
1838 /** | 1838 /** |
1839 * <pre> | 1839 * <pre> |
1840 * variant1 $condition != null | 1840 * variant1 $condition != null |
1841 * | 1841 * |
1842 * $type $name = defaultValue($type); | 1842 * $type $name = defaultValue($type); |
1843 * if ($condition) { | 1843 * if ($condition) { |
1844 * $name = $value; | 1844 * $name = $value; |
1845 * } | 1845 * } |
1846 * | 1846 * |
1847 * variant2 $condition != null | 1847 * variant2 $condition != null |
1848 * $type $name = $value; | 1848 * $type $name = $value; |
1849 * </pre> | 1849 * </pre> |
1850 * | 1850 * |
1851 * . | 1851 * . |