Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeMethodParser.java @ 9417:ffa27c3058e9
minor simplifications for writing compiled stubs
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 29 Apr 2013 21:18:37 +0200 |
parents | 8e3a1635cc9e |
children | 746fa60be266 |
rev | line source |
---|---|
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.codegen.processor.node; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 import java.util.*; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import javax.lang.model.element.*; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 import javax.lang.model.type.*; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 import com.oracle.truffle.codegen.processor.*; |
9220
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
31 import com.oracle.truffle.codegen.processor.node.NodeChildData.Cardinality; |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
32 import com.oracle.truffle.codegen.processor.node.NodeChildData.ExecutionKind; |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
33 import com.oracle.truffle.codegen.processor.template.*; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
34 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
35 public abstract class NodeMethodParser<E extends TemplateMethod> extends TemplateMethodParser<NodeData, E> { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
36 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
37 public NodeMethodParser(ProcessorContext context, NodeData node) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
38 super(context, node); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
39 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 public NodeData getNode() { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 return template; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 |
9287
8e3a1635cc9e
Implemented @NodeChild(executeWith={...}).
Christian Humer <christian.humer@gmail.com>
parents:
9227
diff
changeset
|
45 @SuppressWarnings("unused") |
8e3a1635cc9e
Implemented @NodeChild(executeWith={...}).
Christian Humer <christian.humer@gmail.com>
parents:
9227
diff
changeset
|
46 protected ParameterSpec createValueParameterSpec(String valueName, NodeData nodeData, int evaluatedCount) { |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
47 ParameterSpec spec = new ParameterSpec(valueName, nodeTypeMirrors(nodeData)); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 spec.setSignature(true); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 return spec; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 |
9217
61ba6fc21ba4
Sourcegen can now generate execute methods of signature execute(frame, evaluatedValue).
Christian Humer <christian.humer@gmail.com>
parents:
8662
diff
changeset
|
52 protected List<TypeMirror> nodeTypeMirrors(NodeData nodeData) { |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 Set<TypeMirror> typeMirrors = new LinkedHashSet<>(); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 for (ExecutableTypeData typeData : nodeData.getExecutableTypes()) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
56 typeMirrors.add(typeData.getType().getPrimitiveType()); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
57 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
58 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 typeMirrors.add(nodeData.getTypeSystem().getGenericType()); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 return new ArrayList<>(typeMirrors); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 protected ParameterSpec createReturnParameterSpec() { |
9287
8e3a1635cc9e
Implemented @NodeChild(executeWith={...}).
Christian Humer <christian.humer@gmail.com>
parents:
9227
diff
changeset
|
65 return createValueParameterSpec("returnValue", getNode(), 0); |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
66 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
67 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
68 @Override |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
69 public boolean isParsable(ExecutableElement method) { |
9217
61ba6fc21ba4
Sourcegen can now generate execute methods of signature execute(frame, evaluatedValue).
Christian Humer <christian.humer@gmail.com>
parents:
8662
diff
changeset
|
70 if (getAnnotationType() != null) { |
61ba6fc21ba4
Sourcegen can now generate execute methods of signature execute(frame, evaluatedValue).
Christian Humer <christian.humer@gmail.com>
parents:
8662
diff
changeset
|
71 return Utils.findAnnotationMirror(getContext().getEnvironment(), method, getAnnotationType()) != null; |
61ba6fc21ba4
Sourcegen can now generate execute methods of signature execute(frame, evaluatedValue).
Christian Humer <christian.humer@gmail.com>
parents:
8662
diff
changeset
|
72 } |
61ba6fc21ba4
Sourcegen can now generate execute methods of signature execute(frame, evaluatedValue).
Christian Humer <christian.humer@gmail.com>
parents:
8662
diff
changeset
|
73 |
61ba6fc21ba4
Sourcegen can now generate execute methods of signature execute(frame, evaluatedValue).
Christian Humer <christian.humer@gmail.com>
parents:
8662
diff
changeset
|
74 return true; |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
75 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
76 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 @SuppressWarnings("unused") |
9217
61ba6fc21ba4
Sourcegen can now generate execute methods of signature execute(frame, evaluatedValue).
Christian Humer <christian.humer@gmail.com>
parents:
8662
diff
changeset
|
78 protected final MethodSpec createDefaultMethodSpec(ExecutableElement method, AnnotationMirror mirror, boolean shortCircuitsEnabled, String shortCircuitName) { |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
79 MethodSpec methodSpec = new MethodSpec(createReturnParameterSpec()); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
80 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
81 if (getNode().supportsFrame()) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
82 methodSpec.addOptional(new ParameterSpec("frame", getContext().getTruffleTypes().getFrame())); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
84 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
85 resolveAndAddImplicitThis(methodSpec, method); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
86 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
87 for (NodeFieldData field : getNode().getFields()) { |
9220
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
88 if (!Utils.isFieldAccessible(method, field.getVariable())) { |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
89 ParameterSpec spec = new ParameterSpec(field.getName(), field.getType()); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 spec.setLocal(true); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 methodSpec.addOptional(spec); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 |
9220
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
95 // children are null when parsing executable types |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
96 if (getNode().getChildren() != null) { |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
97 for (NodeChildData child : getNode().getChildren()) { |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
98 if (child.getExecutionKind() == ExecutionKind.DEFAULT) { |
9287
8e3a1635cc9e
Implemented @NodeChild(executeWith={...}).
Christian Humer <christian.humer@gmail.com>
parents:
9227
diff
changeset
|
99 ParameterSpec spec = createValueParameterSpec(child.getName(), child.getNodeData(), child.getExecuteWith().size()); |
9220
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
100 if (child.getCardinality().isMany()) { |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
101 spec.setCardinality(Cardinality.MANY); |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
102 spec.setIndexed(true); |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
103 } |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
104 methodSpec.addRequired(spec); |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
105 } else if (child.getExecutionKind() == ExecutionKind.SHORT_CIRCUIT) { |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
106 String valueName = child.getName(); |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
107 if (shortCircuitName != null && valueName.equals(shortCircuitName)) { |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
108 break; |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
109 } |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 |
9220
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
111 if (shortCircuitsEnabled) { |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
112 methodSpec.addRequired(new ParameterSpec(shortCircuitValueName(valueName), getContext().getType(boolean.class))); |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
113 } |
9287
8e3a1635cc9e
Implemented @NodeChild(executeWith={...}).
Christian Humer <christian.humer@gmail.com>
parents:
9227
diff
changeset
|
114 methodSpec.addRequired(createValueParameterSpec(valueName, child.getNodeData(), child.getExecuteWith().size())); |
9220
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
115 } else { |
97ad6d3e7557
Codegen API changes. Executed child nodes are now defined using @NodeChildren instead of fields.
Christian Humer <christian.humer@gmail.com>
parents:
9217
diff
changeset
|
116 assert false; |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
117 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
118 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
119 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
120 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
121 return methodSpec; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
122 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
123 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
124 protected void resolveAndAddImplicitThis(MethodSpec methodSpec, ExecutableElement method) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
125 TypeMirror declaredType = Utils.findNearestEnclosingType(method).asType(); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
126 |
9227
6d92fdf1c999
Fixes several minor issues.
Christian Humer <christian.humer@gmail.com>
parents:
9220
diff
changeset
|
127 if (!method.getModifiers().contains(Modifier.STATIC) && !Utils.isAssignable(getContext(), declaredType, getContext().getTruffleTypes().getNode())) { |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
128 methodSpec.addImplicitRequiredType(getNode().getTemplateType().asType()); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
131 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
132 private static String shortCircuitValueName(String valueName) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
133 return "has" + Utils.firstLetterUpperCase(valueName); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
134 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
135 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
136 } |