annotate graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationData.java @ 8592:a80bf36c6a1e

Refactor to shared template method signature comparison.
author Christian Humer <christian.humer@gmail.com>
date Mon, 01 Apr 2013 11:52:38 +0200
parents 89006c76f737
children 8a1115c92271
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
1 /*
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
4 *
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
8 *
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
13 * accompanied this code).
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
14 *
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
18 *
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
21 * questions.
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
22 */
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
23 package com.oracle.truffle.codegen.processor.node;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
24
8242
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 7847
diff changeset
25 import java.util.*;
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 7847
diff changeset
26
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
27 import com.oracle.truffle.api.codegen.*;
8251
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
28 import com.oracle.truffle.codegen.processor.*;
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: 8256
diff changeset
29 import com.oracle.truffle.codegen.processor.node.NodeFieldData.*;
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
30 import com.oracle.truffle.codegen.processor.template.*;
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.*;
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
32
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
33 public class SpecializationData extends TemplateMethod {
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
34
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
35 private final int order;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
36 private final boolean generic;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
37 private final boolean uninitialized;
8243
d81ff782fa1a Removed @SpecializationThrows from codegen API. Replaced it by a simplier version in @Specialization.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
38 private final List<SpecializationThrowsData> exceptions;
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
39 private List<String> guardDefinitions = Collections.emptyList();
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
40 private List<GuardData> guards;
8252
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
41 private List<ShortCircuitData> shortCircuits;
7751
ef1b41ea0a90 Implemented an option to turn off generated generic generation using specializations in @Generic.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
42 private boolean useSpecializationsForGeneric = true;
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
43 private NodeData node;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
44
8243
d81ff782fa1a Removed @SpecializationThrows from codegen API. Replaced it by a simplier version in @Specialization.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
45 public SpecializationData(TemplateMethod template, int order, List<SpecializationThrowsData> exceptions) {
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
46 super(template);
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
47 this.order = order;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
48 this.generic = false;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
49 this.uninitialized = false;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
50 this.exceptions = exceptions;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
51
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
52 for (SpecializationThrowsData exception : exceptions) {
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
53 exception.setSpecialization(this);
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
54 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
55 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
56
8256
4dc7034317ec Cleanup.
Christian Humer <christian.humer@gmail.com>
parents: 8252
diff changeset
57 public SpecializationData(TemplateMethod template, boolean generic, boolean uninitialized) {
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
58 super(template);
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
59 this.order = Specialization.DEFAULT_ORDER;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
60 this.generic = generic;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
61 this.uninitialized = uninitialized;
8243
d81ff782fa1a Removed @SpecializationThrows from codegen API. Replaced it by a simplier version in @Specialization.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
62 this.exceptions = Collections.emptyList();
8252
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
63 this.guards = new ArrayList<>();
8251
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
64 }
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
65
8252
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
66 @Override
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
67 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
68 List<MessageContainer> sinks = new ArrayList<>();
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
69 if (exceptions != null) {
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
70 sinks.addAll(exceptions);
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
71 }
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
72 if (guards != null) {
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
73 sinks.addAll(guards);
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
74 }
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
75 return sinks;
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
8251
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
78 public boolean hasRewrite(ProcessorContext context) {
8252
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
79 if (!getExceptions().isEmpty()) {
8251
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
80 return true;
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
81 }
8252
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
82 if (!getGuards().isEmpty()) {
8251
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
83 return true;
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
84 }
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
85 for (ActualParameter parameter : getParameters()) {
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
86 NodeFieldData field = getNode().findField(parameter.getSpecification().getName());
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: 8256
diff changeset
87 if (field == null || field.getKind() == FieldKind.FIELD) {
8251
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
88 continue;
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
89 }
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
90 ExecutableTypeData type = field.getNodeData().findExecutableType(parameter.getActualTypeData(field.getNodeData().getTypeSystem()));
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
91 if (type.hasUnexpectedValue(context)) {
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
92 return true;
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
93 }
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
94 }
cb70ed101b5f Added automatic generation of generic specialization which throws unsupported operation if reached.
Christian Humer <christian.humer@gmail.com>
parents: 8243
diff changeset
95 return false;
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
96 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
97
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
98 public NodeData getNode() {
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
99 return node;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
100 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
101
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
102 public void setNode(NodeData node) {
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
103 this.node = node;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
104 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
105
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
106 public void setGuards(List<GuardData> guards) {
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
107 this.guards = guards;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
108 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
109
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
110 public void setGuardDefinitions(List<String> guardDefinitions) {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
111 this.guardDefinitions = guardDefinitions;
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
112 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
113
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
114 public int getOrder() {
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
115 return order;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
116 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
117
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
118 public boolean isGeneric() {
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
119 return generic;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
120 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
121
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
122 public boolean isUninitialized() {
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
123 return uninitialized;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
124 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
125
8243
d81ff782fa1a Removed @SpecializationThrows from codegen API. Replaced it by a simplier version in @Specialization.
Christian Humer <christian.humer@gmail.com>
parents: 8242
diff changeset
126 public List<SpecializationThrowsData> getExceptions() {
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
127 return exceptions;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
128 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
129
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
130 public List<String> getGuardDefinitions() {
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
131 return guardDefinitions;
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
132 }
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
133
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
134 public List<GuardData> getGuards() {
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
135 return guards;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
136 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
137
8252
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
138 public void setShortCircuits(List<ShortCircuitData> shortCircuits) {
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
139 this.shortCircuits = shortCircuits;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
140 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
141
8252
0905d796944a Refactored codegen error model to make error redirection a lot easier.
Christian Humer <christian.humer@gmail.com>
parents: 8251
diff changeset
142 public List<ShortCircuitData> getShortCircuits() {
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
143 return shortCircuits;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
144 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
145
7751
ef1b41ea0a90 Implemented an option to turn off generated generic generation using specializations in @Generic.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
146 void setUseSpecializationsForGeneric(boolean useSpecializationsForGeneric) {
ef1b41ea0a90 Implemented an option to turn off generated generic generation using specializations in @Generic.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
147 this.useSpecializationsForGeneric = useSpecializationsForGeneric;
ef1b41ea0a90 Implemented an option to turn off generated generic generation using specializations in @Generic.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
148 }
ef1b41ea0a90 Implemented an option to turn off generated generic generation using specializations in @Generic.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
149
ef1b41ea0a90 Implemented an option to turn off generated generic generation using specializations in @Generic.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
150 public boolean isUseSpecializationsForGeneric() {
ef1b41ea0a90 Implemented an option to turn off generated generic generation using specializations in @Generic.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
151 return useSpecializationsForGeneric;
ef1b41ea0a90 Implemented an option to turn off generated generic generation using specializations in @Generic.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
152 }
ef1b41ea0a90 Implemented an option to turn off generated generic generation using specializations in @Generic.
Christian Humer <christian.humer@gmail.com>
parents: 7502
diff changeset
153
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
154 public SpecializationData findNextSpecialization() {
8242
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 7847
diff changeset
155 List<SpecializationData> specializations = node.getSpecializations();
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 7847
diff changeset
156 for (int i = 0; i < specializations.size() - 1; i++) {
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 7847
diff changeset
157 if (specializations.get(i) == this) {
ac4e8c16ffdf Added new codegen api classes NodeId, NodeClass to codegen along with some refactorings.
Christian Humer <christian.humer@gmail.com>
parents: 7847
diff changeset
158 return specializations.get(i + 1);
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
159 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
160 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
161 return null;
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
162 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
163
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
164 public boolean hasDynamicGuards() {
8592
a80bf36c6a1e Refactor to shared template method signature comparison.
Christian Humer <christian.humer@gmail.com>
parents: 8310
diff changeset
165 return !getGuards().isEmpty();
7502
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
166 }
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
167
6343a09b2ec1 Codegen operation generation is inferred from the node type hierarchy.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
168 }