Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeMethodParser.java @ 8595:8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 01 Apr 2013 21:43:20 +0200 |
parents | ce6e8672f798 |
children | 61ba6fc21ba4 |
comparison
equal
deleted
inserted
replaced
8594:ce6e8672f798 | 8595:8a1115c92271 |
---|---|
40 setParseNullOnError(false); | 40 setParseNullOnError(false); |
41 } | 41 } |
42 | 42 |
43 @Override | 43 @Override |
44 public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) { | 44 public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) { |
45 | |
45 List<TypeMirror> types = new ArrayList<>(); | 46 List<TypeMirror> types = new ArrayList<>(); |
46 types.addAll(getNode().getTypeSystem().getPrimitiveTypeMirrors()); | 47 types.addAll(getNode().getTypeSystem().getPrimitiveTypeMirrors()); |
47 types.add(getContext().getType(void.class)); | 48 types.add(getContext().getType(void.class)); |
48 | 49 |
49 ParameterSpec returnTypeSpec = new ParameterSpec("executedValue", types); | 50 ParameterSpec returnTypeSpec = new ParameterSpec("executedValue", types); |
50 returnTypeSpec.setSignature(true); | 51 returnTypeSpec.setSignature(true); |
51 | 52 MethodSpec spec = new MethodSpec(returnTypeSpec); |
52 List<ParameterSpec> parameters = new ArrayList<>(); | 53 spec.addOptional(new ParameterSpec("frame", getContext().getTruffleTypes().getFrame())); |
53 ParameterSpec frameSpec = new ParameterSpec("frame", getContext().getTruffleTypes().getFrame()); | 54 return spec; |
54 frameSpec.setOptional(true); | |
55 parameters.add(frameSpec); | |
56 return new MethodSpec(new ArrayList<TypeMirror>(), returnTypeSpec, parameters); | |
57 } | 55 } |
58 | 56 |
59 @Override | 57 @Override |
60 public final boolean isParsable(ExecutableElement method) { | 58 public final boolean isParsable(ExecutableElement method) { |
61 boolean parsable = method.getSimpleName().toString().startsWith("execute"); | 59 boolean parsable = method.getSimpleName().toString().startsWith("execute"); |