Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java @ 9217:61ba6fc21ba4
Sourcegen can now generate execute methods of signature execute(frame, evaluatedValue).
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 15 Apr 2013 18:50:19 +0200 |
parents | 8b9ea2f5c36e |
children | 97ad6d3e7557 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java Mon Apr 08 18:28:41 2013 +0200 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java Mon Apr 15 18:50:19 2013 +0200 @@ -46,7 +46,7 @@ private List<SpecializationData> specializations; private List<SpecializationListenerData> specializationListeners; - private List<ExecutableTypeData> executableTypes; + private Map<Integer, List<ExecutableTypeData>> executableTypes; private List<ShortCircuitData> shortCircuits; public NodeData(TypeElement type, String id) { @@ -92,7 +92,7 @@ children.addAll(specializationListeners); } if (executableTypes != null) { - children.addAll(executableTypes); + children.addAll(getExecutableTypes()); } if (shortCircuits != null) { children.addAll(shortCircuits); @@ -134,9 +134,11 @@ } public boolean supportsFrame() { - for (ExecutableTypeData execType : executableTypes) { - if (execType.findParameter("frameValue") == null) { - return false; + if (executableTypes != null) { + for (ExecutableTypeData execType : getExecutableTypes(-1)) { + if (execType.findParameter("frameValue") == null) { + return false; + } } } return true; @@ -213,9 +215,21 @@ return null; } + public List<ExecutableTypeData> getExecutableTypes(int evaluatedCount) { + if (evaluatedCount == -1) { + List<ExecutableTypeData> typeData = new ArrayList<>(); + for (int currentEvaluationCount : executableTypes.keySet()) { + typeData.addAll(executableTypes.get(currentEvaluationCount)); + } + return typeData; + } else { + return executableTypes.get(evaluatedCount); + } + } + public List<ExecutableTypeData> findGenericExecutableTypes(ProcessorContext context) { List<ExecutableTypeData> types = new ArrayList<>(); - for (ExecutableTypeData type : executableTypes) { + for (ExecutableTypeData type : getExecutableTypes(0)) { if (!type.hasUnexpectedValue(context)) { types.add(type); } @@ -224,7 +238,7 @@ } public ExecutableTypeData findExecutableType(TypeData prmitiveType) { - for (ExecutableTypeData type : executableTypes) { + for (ExecutableTypeData type : getExecutableTypes(0)) { if (Utils.typeEquals(type.getType().getPrimitiveType(), prmitiveType.getPrimitiveType())) { return type; } @@ -235,7 +249,7 @@ public SpecializationData findUniqueSpecialization(TypeData type) { SpecializationData result = null; for (SpecializationData specialization : specializations) { - if (specialization.getReturnType().getActualTypeData(getTypeSystem()) == type) { + if (specialization.getReturnType().getTypeSystemType() == type) { if (result != null) { // Result not unique; return null; @@ -246,14 +260,6 @@ return result; } - public List<TypeMirror> getExecutablePrimitiveTypeMirrors() { - List<TypeMirror> typeMirrors = new ArrayList<>(); - for (ExecutableTypeData executableType : executableTypes) { - typeMirrors.add(executableType.getType().getPrimitiveType()); - } - return typeMirrors; - } - public NodeFieldData[] filterFields(FieldKind fieldKind, ExecutionKind usage) { List<NodeFieldData> filteredFields = new ArrayList<>(); for (NodeFieldData field : getFields()) { @@ -266,15 +272,6 @@ return filteredFields.toArray(new NodeFieldData[filteredFields.size()]); } - public boolean hasUnexpectedExecutableTypes(ProcessorContext context) { - for (ExecutableTypeData type : getExecutableTypes()) { - if (type.hasUnexpectedValue(context)) { - return true; - } - } - return false; - } - public boolean needsRewrites(ProcessorContext context) { boolean needsRewrites = false; @@ -408,7 +405,7 @@ } public List<ExecutableTypeData> getExecutableTypes() { - return executableTypes; + return getExecutableTypes(-1); } public List<ShortCircuitData> getShortCircuits() { @@ -428,7 +425,7 @@ this.specializationListeners = specializationListeners; } - void setExecutableTypes(List<ExecutableTypeData> executableTypes) { + void setExecutableTypes(Map<Integer, List<ExecutableTypeData>> executableTypes) { this.executableTypes = executableTypes; }