Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java @ 9287:8e3a1635cc9e
Implemented @NodeChild(executeWith={...}).
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 24 Apr 2013 21:50:03 +0200 |
parents | 97ad6d3e7557 |
children | 763100239da6 |
rev | line source |
---|---|
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.codegen.processor.template; |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
7502
6343a09b2ec1
Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
7291
diff
changeset
|
25 import java.util.*; |
6343a09b2ec1
Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
7291
diff
changeset
|
26 |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import javax.lang.model.type.*; |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 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:
8595
diff
changeset
|
30 import com.oracle.truffle.codegen.processor.node.NodeChildData.Cardinality; |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
31 import com.oracle.truffle.codegen.processor.template.MethodSpec.TypeDef; |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
32 |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
33 public class ParameterSpec { |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
34 |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
35 private final String name; |
8252
0905d796944a
Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents:
8237
diff
changeset
|
36 private final List<TypeMirror> allowedTypes; |
8593
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
37 |
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
38 /** Cardinality one or multiple. */ |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
39 private Cardinality cardinality = Cardinality.ONE; |
8593
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
40 /** Type is part of the method signature. Relevant for comparisons. */ |
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
41 private boolean signature; |
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
42 /** Type must be indexed when parsing. */ |
8237
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
43 private boolean indexed; |
8593
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
44 /** Type is bound to local final variable. */ |
8310
89006c76f737
Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
Christian Humer <christian.humer@gmail.com>
parents:
8252
diff
changeset
|
45 private boolean local; |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
47 private TypeDef typeDefinition; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
48 |
8593
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
49 public ParameterSpec(String name, TypeMirror... allowedTypes) { |
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
50 this(name, Arrays.asList(allowedTypes)); |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 } |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 |
8593
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
53 public ParameterSpec(String name, List<TypeMirror> allowedTypes) { |
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
54 this.name = name; |
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
55 this.allowedTypes = allowedTypes; |
7502
6343a09b2ec1
Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
7291
diff
changeset
|
56 } |
6343a09b2ec1
Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
7291
diff
changeset
|
57 |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
58 void setTypeDefinition(TypeDef typeDefinition) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
59 this.typeDefinition = typeDefinition; |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
60 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
61 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
62 TypeDef getTypeDefinition() { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
63 return typeDefinition; |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 } |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
65 |
8593
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
66 public void setSignature(boolean signature) { |
54e227b2e199
Refactored ParameterSpec constructors.
Christian Humer <christian.humer@gmail.com>
parents:
8592
diff
changeset
|
67 this.signature = signature; |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
68 } |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
69 |
8310
89006c76f737
Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
Christian Humer <christian.humer@gmail.com>
parents:
8252
diff
changeset
|
70 public void setLocal(boolean local) { |
89006c76f737
Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
Christian Humer <christian.humer@gmail.com>
parents:
8252
diff
changeset
|
71 this.local = local; |
89006c76f737
Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
Christian Humer <christian.humer@gmail.com>
parents:
8252
diff
changeset
|
72 } |
89006c76f737
Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
Christian Humer <christian.humer@gmail.com>
parents:
8252
diff
changeset
|
73 |
8592
a80bf36c6a1e
Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents:
8310
diff
changeset
|
74 public boolean isSignature() { |
a80bf36c6a1e
Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents:
8310
diff
changeset
|
75 return signature; |
a80bf36c6a1e
Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents:
8310
diff
changeset
|
76 } |
a80bf36c6a1e
Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents:
8310
diff
changeset
|
77 |
8310
89006c76f737
Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
Christian Humer <christian.humer@gmail.com>
parents:
8252
diff
changeset
|
78 public boolean isLocal() { |
89006c76f737
Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
Christian Humer <christian.humer@gmail.com>
parents:
8252
diff
changeset
|
79 return local; |
89006c76f737
Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
Christian Humer <christian.humer@gmail.com>
parents:
8252
diff
changeset
|
80 } |
89006c76f737
Final fields of base node can be optionally passed to builtin specialization method. And a few fixes.
Christian Humer <christian.humer@gmail.com>
parents:
8252
diff
changeset
|
81 |
8237
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
82 public boolean isIndexed() { |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
83 return indexed; |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
84 } |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
85 |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
86 public void setIndexed(boolean indexed) { |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
87 this.indexed = indexed; |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
88 } |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
89 |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
90 public void setCardinality(Cardinality cardinality) { |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
91 this.cardinality = cardinality; |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
92 } |
6b74ffe38183
Implemented support for executing nodes in @Children fields.
Christian Humer <christian.humer@gmail.com>
parents:
7794
diff
changeset
|
93 |
8594
ce6e8672f798
Renamed node method parser base class.
Christian Humer <christian.humer@gmail.com>
parents:
8593
diff
changeset
|
94 public String getName() { |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 return name; |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 } |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 |
8594
ce6e8672f798
Renamed node method parser base class.
Christian Humer <christian.humer@gmail.com>
parents:
8593
diff
changeset
|
98 public Cardinality getCardinality() { |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 return cardinality; |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 } |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 |
8252
0905d796944a
Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents:
8237
diff
changeset
|
102 public List<TypeMirror> getAllowedTypes() { |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 return allowedTypes; |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 } |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 public boolean matches(TypeMirror actualType) { |
8252
0905d796944a
Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents:
8237
diff
changeset
|
107 for (TypeMirror mirror : allowedTypes) { |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 if (Utils.typeEquals(actualType, mirror)) { |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 return true; |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 } |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 } |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 return false; |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 } |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 |
8595
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
115 @Override |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
116 public String toString() { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
117 return toSignatureString(false); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
118 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
119 |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
120 public String toSignatureString(boolean typeOnly) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
121 StringBuilder builder = new StringBuilder(); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
122 if (typeDefinition != null) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
123 builder.append("<" + typeDefinition.getName() + ">"); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
124 } else if (getAllowedTypes().size() >= 1) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
125 builder.append(Utils.getSimpleName(getAllowedTypes().get(0))); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
126 } else { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
127 builder.append("void"); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
128 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
129 if (!typeOnly) { |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
130 builder.append(" "); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
131 builder.append(getName()); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
132 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
133 return builder.toString(); |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
134 } |
8a1115c92271
Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents:
8594
diff
changeset
|
135 |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
136 } |