Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationData.java @ 8251:cb70ed101b5f
Added automatic generation of generic specialization which throws unsupported operation if reached.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 13 Mar 2013 11:32:43 +0100 |
parents | d81ff782fa1a |
children | 0905d796944a |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationData.java Tue Mar 12 11:38:52 2013 +0100 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationData.java Wed Mar 13 11:32:43 2013 +0100 @@ -25,6 +25,7 @@ import java.util.*; import com.oracle.truffle.api.codegen.*; +import com.oracle.truffle.codegen.processor.*; import com.oracle.truffle.codegen.processor.template.*; public class SpecializationData extends TemplateMethod { @@ -38,11 +39,14 @@ private boolean useSpecializationsForGeneric = true; private NodeData node; + private final boolean synthetic; + public SpecializationData(TemplateMethod template, int order, List<SpecializationThrowsData> exceptions) { super(template); this.order = order; this.generic = false; this.uninitialized = false; + this.synthetic = false; this.exceptions = exceptions; for (SpecializationThrowsData exception : exceptions) { @@ -50,13 +54,34 @@ } } - public SpecializationData(TemplateMethod template, boolean generic, boolean uninitialized) { + public SpecializationData(TemplateMethod template, boolean generic, boolean uninitialized, boolean synthetic) { super(template); this.order = Specialization.DEFAULT_ORDER; this.generic = generic; this.uninitialized = uninitialized; this.exceptions = Collections.emptyList(); this.guards = new SpecializationGuardData[0]; + this.synthetic = synthetic; + } + + public boolean hasRewrite(ProcessorContext context) { + if (getExceptions().size() > 0) { + return true; + } + if (getGuards().length > 0) { + return true; + } + for (ActualParameter parameter : getParameters()) { + NodeFieldData field = getNode().findField(parameter.getSpecification().getName()); + if (field == null) { + continue; + } + ExecutableTypeData type = field.getNodeData().findExecutableType(parameter.getActualTypeData(field.getNodeData().getTypeSystem())); + if (type.hasUnexpectedValue(context)) { + return true; + } + } + return false; } public NodeData getNode() { @@ -71,6 +96,10 @@ this.guards = guards; } + public boolean isSynthetic() { + return synthetic; + } + public int getOrder() { return order; }