# HG changeset patch # User Christian Humer # Date 1429198243 -7200 # Node ID ef2825da2e438cc1b6ce7faa5766be85a01c3fbf # Parent 8e5f9310f3aa46e36c3ba37338885e227970c721 Truffle-DSL: fixed generation of unused synthetic execute methods. diff -r 8e5f9310f3aa -r ef2825da2e43 graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java --- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java Thu Apr 16 21:29:56 2015 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java Thu Apr 16 17:30:43 2015 +0200 @@ -211,22 +211,46 @@ } } - for (ExecutableTypeData execType : usedTypes) { - if (!singleSpecializable && execType.getMethod() == null) { - continue; - } - clazz.add(createExecutableTypeOverride(usedTypes, execType)); - } - clazz.add(createGetCostMethod()); avoidFindbugsProblems(clazz); if (singleSpecializable) { + SpecializationData specialization = reachableSpecializations.iterator().next(); + + for (ExecutableTypeData execType : usedTypes) { + if (execType.getMethod() == null) { + boolean foundDelegate = false; + for (ExecutableTypeData type : usedTypes) { + if (type == execType) { + continue; + } + if (findFastPathDelegate(specialization.getReturnType().getType(), type, usedTypes) == execType) { + foundDelegate = true; + break; + } + } + // just exclude synthetic execute methods that were not delegated to + if (!foundDelegate) { + continue; + } + } + + clazz.add(createExecutableTypeOverride(usedTypes, execType)); + } + if (node.needsRewrites(context)) { clazz.add(createUnsupportedMethod()); } } else { + + for (ExecutableTypeData execType : usedTypes) { + if (execType.getMethod() == null) { + continue; + } + clazz.add(createExecutableTypeOverride(usedTypes, execType)); + } + clazz.getImplements().add(getType(SpecializedNode.class)); clazz.add(createMethodGetSpecializationNode()); clazz.add(createDeepCopyMethod()); @@ -242,7 +266,7 @@ } } - for (TypeMirror type : ElementUtils.uniqueSortedTypes(expectedTypes)) { + for (TypeMirror type : ElementUtils.uniqueSortedTypes(expectedTypes, false)) { if (!typeSystem.hasType(type)) { clazz.addOptional(TypeSystemCodeGenerator.createExpectMethod(PRIVATE, typeSystem, context.getType(Object.class), type)); }