annotate graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethod.java @ 9094:6194aefabf1a

weakened assertion in unsafe.cpp for GRAAL builds such that non-GRAAL builds still work
author Doug Simon <doug.simon@oracle.com>
date Fri, 12 Apr 2013 21:41:34 +0200
parents 5eeade940236
children 9dfefdee8f3f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
8245
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
25 import java.util.*;
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
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.element.*;
8245
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
28 import javax.lang.model.type.*;
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
29
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
30 import com.oracle.truffle.codegen.processor.*;
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
31 import com.oracle.truffle.codegen.processor.typesystem.*;
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
8595
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
33 /**
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
34 * Note: this class has a natural ordering that is inconsistent with equals.
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
35 */
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
36 public class TemplateMethod extends MessageContainer implements Comparable<TemplateMethod> {
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
37
8245
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
38 private String id;
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents: 7291
diff changeset
39 private final Template template;
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
40 private final MethodSpec specification;
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
41 private final ExecutableElement method;
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
42 private final AnnotationMirror markerAnnotation;
8662
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
43 private ActualParameter returnType;
8595
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
44 private List<ActualParameter> parameters;
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
45
8245
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
46 public TemplateMethod(String id, Template template, MethodSpec specification, ExecutableElement method, AnnotationMirror markerAnnotation, ActualParameter returnType,
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
47 List<ActualParameter> parameters) {
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents: 7291
diff changeset
48 this.template = template;
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
49 this.specification = specification;
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
50 this.method = method;
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 this.markerAnnotation = markerAnnotation;
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 this.returnType = returnType;
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
53 this.parameters = parameters;
8242
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 8237
diff changeset
54 this.id = id;
7847
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
55
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
56 if (parameters != null) {
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
57 for (ActualParameter param : parameters) {
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
58 param.setMethod(this);
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
59 }
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
60 }
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
61 }
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
62
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
63 public TemplateMethod(TemplateMethod method) {
8242
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 8237
diff changeset
64 this(method.id, method.template, method.specification, method.method, method.markerAnnotation, method.returnType, method.parameters);
8252
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
65 getMessages().addAll(method.getMessages());
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
66 }
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
67
8595
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
68 public void setParameters(List<ActualParameter> parameters) {
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
69 this.parameters = parameters;
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
70 }
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
71
8252
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
72 @Override
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
73 public Element getMessageElement() {
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
74 return method;
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
75 }
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
76
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
77 @Override
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
78 public AnnotationMirror getMessageAnnotation() {
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
79 return markerAnnotation;
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
80 }
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
81
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
82 @Override
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
83 protected List<MessageContainer> findChildContainers() {
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
84 return Collections.emptyList();
8242
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 8237
diff changeset
85 }
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 8237
diff changeset
86
8245
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
87 public void setId(String id) {
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
88 this.id = id;
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
89 }
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
90
8242
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 8237
diff changeset
91 public String getId() {
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 8237
diff changeset
92 return id;
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
93 }
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
94
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents: 7291
diff changeset
95 public Template getTemplate() {
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents: 7291
diff changeset
96 return template;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents: 7291
diff changeset
97 }
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
98
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 public MethodSpec getSpecification() {
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 return specification;
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 }
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
102
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 public ActualParameter getReturnType() {
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 return returnType;
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
8662
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
107 public void replaceParameter(String localName, ActualParameter newParameter) {
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
108 if (returnType.getLocalName().equals(localName)) {
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
109 returnType = newParameter;
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
110 returnType.setMethod(this);
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
111 }
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
112
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
113 for (ListIterator<ActualParameter> iterator = parameters.listIterator(); iterator.hasNext();) {
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
114 ActualParameter parameter = iterator.next();
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
115 if (parameter.getLocalName().equals(localName)) {
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
116 iterator.set(newParameter);
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
117 newParameter.setMethod(this);
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
118 }
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
119 }
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
120 }
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
121
8595
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
122 public List<ActualParameter> getRequiredParameters() {
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
123 List<ActualParameter> requiredParameters = new ArrayList<>();
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
124 for (ActualParameter parameter : getParameters()) {
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
125 if (getSpecification().getRequired().contains(parameter.getSpecification())) {
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
126 requiredParameters.add(parameter);
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
127 }
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
128 }
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
129 return requiredParameters;
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
130 }
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
131
8245
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
132 public List<ActualParameter> getParameters() {
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
133 return parameters;
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
134 }
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
135
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 public ActualParameter findParameter(String valueName) {
8662
5eeade940236 Fixed user generic signature must not match generated generic signature.
Christian Humer <christian.humer@gmail.com>
parents: 8595
diff changeset
137 for (ActualParameter param : getReturnTypeAndParameters()) {
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
138 if (param.getLocalName().equals(valueName)) {
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
139 return param;
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
140 }
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
141 }
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
142 return null;
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
143 }
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
144
8245
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
145 public List<ActualParameter> getReturnTypeAndParameters() {
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
146 List<ActualParameter> allParameters = new ArrayList<>(getParameters().size() + 1);
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
147 allParameters.add(getReturnType());
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
148 allParameters.addAll(getParameters());
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
149 return Collections.unmodifiableList(allParameters);
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
150 }
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
151
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
152 public boolean canBeAccessedByInstanceOf(TypeMirror type) {
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
153 TypeMirror methodType = Utils.findNearestEnclosingType(getMethod()).asType();
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
154 return Utils.isAssignable(type, methodType) || Utils.isAssignable(methodType, type);
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
155 }
703c09f8640c Implemented support for @NodeClass annotation to support builtins.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
156
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
157 public ExecutableElement getMethod() {
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
158 return method;
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
159 }
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
160
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
161 public String getMethodName() {
8251
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8245
diff changeset
162 if (getMethod() != null) {
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8245
diff changeset
163 return getMethod().getSimpleName().toString();
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8245
diff changeset
164 } else {
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8245
diff changeset
165 return "$synthetic";
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8245
diff changeset
166 }
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
167 }
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
168
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
169 public AnnotationMirror getMarkerAnnotation() {
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
170 return markerAnnotation;
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
171 }
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
172
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
173 @Override
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
174 public String toString() {
8595
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
175 return String.format("%s [id = %s, method = %s]", getClass().getSimpleName(), getId(), getMethod());
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
176 }
7847
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
177
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
178 public ActualParameter getPreviousParam(ActualParameter searchParam) {
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
179 ActualParameter prev = null;
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
180 for (ActualParameter param : getParameters()) {
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
181 if (param == searchParam) {
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
182 return prev;
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
183 }
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
184 prev = param;
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
185 }
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
186 return prev;
06a7cd6aaf00 Casting is now done on demand using local variables for explicit guards.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
187 }
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
188
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
189 public List<TypeData> getSignature(TypeSystemData typeSystem) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
190 List<TypeData> types = new ArrayList<>();
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
191 for (ActualParameter parameter : getReturnTypeAndParameters()) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
192 if (!parameter.getSpecification().isSignature()) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
193 continue;
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
194 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
195 TypeData typeData = parameter.getActualTypeData(typeSystem);
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
196 if (typeData != null) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
197 types.add(typeData);
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
198 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
199 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
200 return types;
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
201 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
202
8595
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
203 @Override
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
204 public int compareTo(TemplateMethod o) {
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
205 if (this == o) {
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
206 return 0;
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
207 }
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
208
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
209 int compare = compareBySignature(o);
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
210 if (compare == 0) {
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
211 // if signature sorting failed sort by id
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
212 compare = getId().compareTo(o.getId());
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
213 }
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
214 if (compare == 0) {
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
215 // if still no difference sort by enclosing type name
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
216 TypeElement enclosingType1 = Utils.findNearestEnclosingType(getMethod());
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
217 TypeElement enclosingType2 = Utils.findNearestEnclosingType(o.getMethod());
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
218 compare = enclosingType1.getQualifiedName().toString().compareTo(enclosingType2.getQualifiedName().toString());
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
219 }
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
220 return compare;
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
221 }
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
222
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
223 public int compareBySignature(TemplateMethod compareMethod) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
224 TypeSystemData typeSystem = getTemplate().getTypeSystem();
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
225 if (typeSystem != compareMethod.getTemplate().getTypeSystem()) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
226 throw new IllegalStateException("Cannot compare two methods with different type systems.");
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
227 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
228
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
229 List<TypeData> signature1 = getSignature(typeSystem);
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
230 List<TypeData> signature2 = compareMethod.getSignature(typeSystem);
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
231 if (signature1.size() != signature2.size()) {
8595
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
232 return signature2.size() - signature1.size();
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
233 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
234
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
235 int result = 0;
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
236 for (int i = 0; i < signature1.size(); i++) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
237 int typeResult = compareActualParameter(typeSystem, signature1.get(i), signature2.get(i));
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
238 if (result == 0) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
239 result = typeResult;
8595
8a1115c92271 Implemented codegen guard definitions can now omit unused parameters.
Christian Humer <christian.humer@gmail.com>
parents: 8592
diff changeset
240 } else if (typeResult != 0 && Math.signum(result) != Math.signum(typeResult)) {
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
241 // We cannot define an order.
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
242 return 0;
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
243 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
244 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
245
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
246 return result;
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
247 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
248
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
249 private static int compareActualParameter(TypeSystemData typeSystem, TypeData t1, TypeData t2) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
250 int index1 = typeSystem.findType(t1);
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
251 int index2 = typeSystem.findType(t2);
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
252 return index1 - index2;
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
253 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
254
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
255 }