# HG changeset patch # User Christian Humer # Date 1433847043 -7200 # Node ID 23f0f181bc052bf3703360765d982af77394495c # Parent d358434dd6b76a825341dcf9598635e614e0592d Truffle-DSL: fix unsupported method for single specializable nodes was generated too often. diff -r d358434dd6b7 -r 23f0f181bc05 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 Tue Jun 09 13:19:52 2015 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java Tue Jun 09 12:50:43 2015 +0200 @@ -68,6 +68,7 @@ private final Set expectedTypes = new HashSet<>(); private final Set usedExecuteChildMethods = new HashSet<>(); private boolean nextUsed; + private boolean singleSpecializableUnsupportedUsed; private List usedTypes; private List reachableSpecializations; @@ -239,7 +240,7 @@ clazz.add(createExecutableTypeOverride(usedTypes, execType)); } - if (node.needsRewrites(context)) { + if (singleSpecializableUnsupportedUsed) { clazz.add(createUnsupportedMethod()); } } else { @@ -300,7 +301,6 @@ private Element createUnsupportedMethod() { LocalContext locals = LocalContext.load(this); CodeExecutableElement method = locals.createMethod(modifiers(PROTECTED), getType(UnsupportedSpecializationException.class), "unsupported", varArgsThreshold); - CodeTreeBuilder builder = method.createBuilder(); builder.startReturn(); builder.startNew(getType(UnsupportedSpecializationException.class)); @@ -1512,7 +1512,8 @@ } } - private static CodeTree createThrowUnsupported(LocalContext currentValues) { + private CodeTree createThrowUnsupported(LocalContext currentValues) { + singleSpecializableUnsupportedUsed = true; CodeTreeBuilder builder = CodeTreeBuilder.createBuilder(); builder.startThrow().startCall("unsupported"); currentValues.addReferencesTo(builder);