Mercurial > hg > truffle
changeset 21877:23f0f181bc05
Truffle-DSL: fix unsupported method for single specializable nodes was generated too often.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 09 Jun 2015 12:50:43 +0200 |
parents | d358434dd6b7 |
children | 79fb8b5ef185 |
files | graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeGenFactory.java |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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<TypeMirror> expectedTypes = new HashSet<>(); private final Set<NodeExecutionData> usedExecuteChildMethods = new HashSet<>(); private boolean nextUsed; + private boolean singleSpecializableUnsupportedUsed; private List<ExecutableTypeData> usedTypes; private List<SpecializationData> 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);