Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java @ 11506:e6645c18d154
Truffle-DSL: reduced generated code size by not generating primarily unused primitive type execute methods.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 30 Aug 2013 17:45:53 +0200 |
parents | 5fbd1ba4a5f3 |
children | dcaf879d4a7e |
comparison
equal
deleted
inserted
replaced
11505:578fc20b9380 | 11506:e6645c18d154 |
---|---|
2390 | 2390 |
2391 return builder.getRoot(); | 2391 return builder.getRoot(); |
2392 } | 2392 } |
2393 | 2393 |
2394 private CodeTree createExecuteBody(CodeTreeBuilder parent, SpecializationData specialization, ExecutableTypeData execType) { | 2394 private CodeTree createExecuteBody(CodeTreeBuilder parent, SpecializationData specialization, ExecutableTypeData execType) { |
2395 TypeData primaryType = specialization.getReturnType().getTypeSystemType(); | |
2396 | |
2397 CodeTreeBuilder builder = new CodeTreeBuilder(parent); | 2395 CodeTreeBuilder builder = new CodeTreeBuilder(parent); |
2398 | 2396 |
2399 List<ExecutableTypeData> primaryExecutes = findFunctionalExecutableType(specialization, execType.getEvaluatedCount()); | 2397 List<ExecutableTypeData> primaryExecutes = findFunctionalExecutableType(specialization, execType.getEvaluatedCount()); |
2400 | 2398 |
2401 if (primaryExecutes.contains(execType) || primaryExecutes.isEmpty()) { | 2399 if (primaryExecutes.contains(execType) || primaryExecutes.isEmpty()) { |
2402 builder.tree(createFunctionalExecute(builder, specialization, execType)); | 2400 builder.tree(createFunctionalExecute(builder, specialization, execType)); |
2403 } else if (needsCastingExecuteMethod(execType, primaryType)) { | 2401 } else if (needsCastingExecuteMethod(execType)) { |
2404 assert !primaryExecutes.isEmpty(); | 2402 assert !primaryExecutes.isEmpty(); |
2405 builder.tree(createCastingExecute(builder, specialization, execType, primaryExecutes.get(0))); | 2403 builder.tree(createCastingExecute(builder, specialization, execType, primaryExecutes.get(0))); |
2406 } else { | 2404 } else { |
2407 return null; | 2405 return null; |
2408 } | 2406 } |
2429 method.getAnnotationMirrors().clear(); | 2427 method.getAnnotationMirrors().clear(); |
2430 method.getModifiers().remove(Modifier.ABSTRACT); | 2428 method.getModifiers().remove(Modifier.ABSTRACT); |
2431 return method; | 2429 return method; |
2432 } | 2430 } |
2433 | 2431 |
2434 private boolean needsCastingExecuteMethod(ExecutableTypeData execType, TypeData primaryType) { | 2432 private boolean needsCastingExecuteMethod(ExecutableTypeData execType) { |
2435 if (execType.isAbstract()) { | 2433 if (execType.isAbstract()) { |
2436 return true; | |
2437 } | |
2438 if (Utils.isPrimitiveOrVoid(primaryType.getPrimitiveType()) && Utils.isPrimitiveOrVoid(execType.getType().getPrimitiveType())) { | |
2439 return true; | 2434 return true; |
2440 } | 2435 } |
2441 if (execType.getType().isGeneric()) { | 2436 if (execType.getType().isGeneric()) { |
2442 return true; | 2437 return true; |
2443 } | 2438 } |