Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeData.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 | bd067a48a9c2 |
children | 763100239da6 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeData.java Mon Apr 08 18:28:41 2013 +0200 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeData.java Mon Apr 15 18:50:19 2013 +0200 @@ -22,6 +22,8 @@ */ package com.oracle.truffle.codegen.processor.node; +import java.util.*; + import javax.lang.model.element.*; import com.oracle.truffle.codegen.processor.*; @@ -63,6 +65,43 @@ return getMethod().getModifiers().contains(Modifier.ABSTRACT); } + public int getEvaluatedCount() { + int count = 0; + for (ActualParameter parameter : getParameters()) { + if (parameter.getSpecification().isSignature()) { + count++; + } + } + return count; + } + + public boolean startsWithSignature(TemplateMethod method) { + for (ActualParameter param : getParameters()) { + if (!param.getSpecification().isSignature()) { + continue; + } + ActualParameter foundParam = method.findParameter(param.getLocalName()); + if (foundParam != null) { + TypeData actualType = param.getTypeSystemType(); + TypeData foundType = foundParam.getTypeSystemType(); + if (actualType == null || foundType == null || !actualType.equalsType(foundType)) { + return false; + } + } + } + return true; + } + + public boolean hasGenericSignature() { + List<TypeData> types = getSignature(); + for (TypeData typeData : types) { + if (!typeData.isGeneric()) { + return false; + } + } + return true; + } + @Override public int hashCode() { return type.hashCode();