Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java @ 9279:2a4b57f02fb4
Implemented basic support for assumptions for sourcecode generation.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 24 Apr 2013 17:44:15 +0200 |
parents | 6d92fdf1c999 |
children | 8e3a1635cc9e |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java Tue Apr 23 21:03:47 2013 +0200 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java Wed Apr 24 17:44:15 2013 +0200 @@ -49,6 +49,7 @@ private List<SpecializationListenerData> specializationListeners; private Map<Integer, List<ExecutableTypeData>> executableTypes; private List<ShortCircuitData> shortCircuits; + private List<String> assumptions; public NodeData(TypeElement type, String id) { super(type, null, null); @@ -68,6 +69,7 @@ this.shortCircuits = splitSource.shortCircuits; this.fields = splitSource.fields; this.children = splitSource.children; + this.assumptions = splitSource.assumptions; } public boolean isSplitByMethodName() { @@ -143,6 +145,14 @@ return getTemplateType().asType(); } + void setAssumptions(List<String> assumptions) { + this.assumptions = assumptions; + } + + public List<String> getAssumptions() { + return assumptions; + } + public boolean needsFactory() { if (specializations == null) { return false; @@ -241,6 +251,9 @@ } public List<ExecutableTypeData> getExecutableTypes(int evaluatedCount) { + if (executableTypes == null) { + return Collections.emptyList(); + } if (evaluatedCount == -1) { List<ExecutableTypeData> typeData = new ArrayList<>(); for (int currentEvaluationCount : executableTypes.keySet()) { @@ -304,7 +317,7 @@ break; } } - return needsRewrites; + return needsRewrites || getSpecializations().size() > 1; } public SpecializationData getGenericSpecialization() { @@ -339,6 +352,7 @@ dumpProperty(builder, indent, "fields", getChildren()); dumpProperty(builder, indent, "executableTypes", getExecutableTypes()); dumpProperty(builder, indent, "specializations", getSpecializations()); + dumpProperty(builder, indent, "assumptions", getAssumptions()); dumpProperty(builder, indent, "messages", collectMessages()); if (getDeclaredNodes().size() > 0) { builder.append(String.format("\n%s children = [", indent));