Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/GuardParser.java @ 16820:0370880ac9ce
Truffle-DSL: better caching for type checks.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 13 Aug 2014 18:06:26 +0200 |
parents | 23415229349b |
children | c3c07046a74b |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/GuardParser.java Wed Aug 13 18:06:18 2014 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/GuardParser.java Wed Aug 13 18:06:26 2014 +0200 @@ -58,7 +58,13 @@ if (compatibleSource != null) { spec.getRequired().clear(); for (Parameter parameter : compatibleSource.getRequiredParameters()) { - spec.addRequired(new ParameterSpec(parameter.getSpecification(), ElementUtils.getAssignableTypes(getContext(), parameter.getType()))); + List<TypeMirror> typeMirrors = ElementUtils.getAssignableTypes(getContext(), parameter.getType()); + Set<String> typeIds = new HashSet<>(); + for (TypeMirror typeMirror : typeMirrors) { + typeIds.add(ElementUtils.getUniqueIdentifier(typeMirror)); + } + + spec.addRequired(new ParameterSpec(parameter.getSpecification(), typeMirrors, typeIds)); } } return spec; @@ -73,6 +79,11 @@ } @Override + protected Set<String> nodeTypeIdentifiers(NodeData nodeData) { + return nodeData.getTypeSystem().getTypeIdentifiers(); + } + + @Override protected ParameterSpec createReturnParameterSpec() { return new ParameterSpec("returnType", getContext().getType(boolean.class)); }