Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/SpecializationData.java @ 16765:89f635cbd85e
Truffle-DSL: fixed assertions on unspecified toString methods of the annotation processing API.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 11 Aug 2014 17:20:24 +0200 |
parents | 23415229349b |
children | 6ee7afea175a |
rev | line source |
---|---|
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
16759
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
23 package com.oracle.truffle.dsl.processor.model; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 import java.util.*; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import com.oracle.truffle.dsl.processor.*; |
16759
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
28 import com.oracle.truffle.dsl.processor.java.*; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
30 public final class SpecializationData extends TemplateMethod { |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
31 |
13528
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
32 public enum SpecializationKind { |
14908
8db6e76cb658
Formatter: Keep one enum constant per line
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13532
diff
changeset
|
33 UNINITIALIZED, |
8db6e76cb658
Formatter: Keep one enum constant per line
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13532
diff
changeset
|
34 SPECIALIZED, |
8db6e76cb658
Formatter: Keep one enum constant per line
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13532
diff
changeset
|
35 POLYMORPHIC, |
8db6e76cb658
Formatter: Keep one enum constant per line
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13532
diff
changeset
|
36 GENERIC |
13528
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
37 } |
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
38 |
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
39 private final NodeData node; |
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
40 private final SpecializationKind kind; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 private final List<SpecializationThrowsData> exceptions; |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
42 private List<GuardExpression> guards = Collections.emptyList(); |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 private List<ShortCircuitData> shortCircuits; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 private List<String> assumptions = Collections.emptyList(); |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
45 private final Set<SpecializationData> contains = new TreeSet<>(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
46 private final Set<String> containsNames = new TreeSet<>(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
47 private final Set<SpecializationData> excludedBy = new TreeSet<>(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
48 private String insertBeforeName; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
49 private SpecializationData insertBefore; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 private boolean reachable; |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
51 private int index; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
53 public SpecializationData(NodeData node, TemplateMethod template, SpecializationKind kind, List<SpecializationThrowsData> exceptions) { |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 super(template); |
13528
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
55 this.node = node; |
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
56 this.kind = kind; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
57 this.exceptions = exceptions; |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
58 this.index = template.getNaturalOrder(); |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 for (SpecializationThrowsData exception : exceptions) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 exception.setSpecialization(this); |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
65 public void setInsertBefore(SpecializationData insertBefore) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
66 this.insertBefore = insertBefore; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
67 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
68 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
69 public void setInsertBeforeName(String insertBeforeName) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
70 this.insertBeforeName = insertBeforeName; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
71 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
72 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
73 public SpecializationData getInsertBefore() { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
74 return insertBefore; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
75 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
76 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
77 public String getInsertBeforeName() { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
78 return insertBeforeName; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
79 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
80 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
81 public Set<String> getContainsNames() { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
82 return containsNames; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
83 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
84 |
13528
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
85 public SpecializationData(NodeData node, TemplateMethod template, SpecializationKind kind) { |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
86 this(node, template, kind, new ArrayList<SpecializationThrowsData>()); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
87 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
88 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
89 public Set<SpecializationData> getContains() { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
90 return contains; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
91 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
92 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
93 public Set<SpecializationData> getExcludedBy() { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
94 return excludedBy; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 public void setReachable(boolean reachable) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 this.reachable = reachable; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 public boolean isReachable() { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
102 return reachable; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 public boolean isPolymorphic() { |
13528
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
106 return kind == SpecializationKind.POLYMORPHIC; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 @Override |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 protected List<MessageContainer> findChildContainers() { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 List<MessageContainer> sinks = new ArrayList<>(); |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 if (exceptions != null) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 sinks.addAll(exceptions); |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
115 if (guards != null) { |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
116 for (GuardExpression guard : guards) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
117 if (guard.isResolved()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
118 sinks.add(guard.getResolvedGuard()); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
119 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
120 } |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
121 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
122 return sinks; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
123 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
124 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
125 public boolean hasRewrite(ProcessorContext context) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
126 if (!getExceptions().isEmpty()) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
127 return true; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
128 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 if (!getGuards().isEmpty()) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 return true; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
131 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
132 if (!getAssumptions().isEmpty()) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
133 return true; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
134 } |
16759
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
135 for (Parameter parameter : getSignatureParameters()) { |
13527
25ecb47a6d0e
Truffle-DSL: Added support for references to child arrays in @ShortCircuit;
Christian Humer <christian.humer@gmail.com>
parents:
13271
diff
changeset
|
136 ExecutableTypeData type = parameter.getSpecification().getExecution().getChild().findExecutableType(context, parameter.getTypeSystemType()); |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
137 if (type.hasUnexpectedValue(context)) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
138 return true; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
139 } |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
140 if (type.getReturnType().getTypeSystemType().needsCastTo(parameter.getTypeSystemType())) { |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
141 return true; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
142 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
143 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
144 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
145 return false; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
146 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
147 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
148 @Override |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
149 public int compareTo(TemplateMethod other) { |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
150 if (this == other) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
151 return 0; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
152 } else if (!(other instanceof SpecializationData)) { |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
153 return super.compareTo(other); |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
154 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
155 SpecializationData m2 = (SpecializationData) other; |
13528
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
156 int kindOrder = kind.compareTo(m2.kind); |
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
157 if (kindOrder != 0) { |
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
158 return kindOrder; |
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
159 } |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
160 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
161 int compare = 0; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
162 int order1 = index; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
163 int order2 = m2.index; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
164 if (order1 != NO_NATURAL_ORDER && order2 != NO_NATURAL_ORDER) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
165 compare = Integer.compare(order1, order2); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
166 if (compare != 0) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
167 return compare; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
168 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
169 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
170 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
171 return super.compareTo(other); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
172 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
173 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
174 public void setIndex(int order) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
175 this.index = order; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
176 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
177 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
178 public int getIndex() { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
179 return index; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
180 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
181 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
182 public boolean isContainedBy(SpecializationData next) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
183 if (compareTo(next) > 0) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
184 // must be declared after the current specialization |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
185 return false; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
186 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
187 |
16759
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
188 Iterator<Parameter> currentSignature = getSignatureParameters().iterator(); |
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
189 Iterator<Parameter> nextSignature = next.getSignatureParameters().iterator(); |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
190 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
191 while (currentSignature.hasNext() && nextSignature.hasNext()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
192 TypeData currentType = currentSignature.next().getTypeSystemType(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
193 TypeData prevType = nextSignature.next().getTypeSystemType(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
194 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
195 if (!currentType.isImplicitSubtypeOf(prevType)) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
196 return false; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
197 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
198 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
199 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
200 for (String nextAssumption : next.getAssumptions()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
201 if (!getAssumptions().contains(nextAssumption)) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
202 return false; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
203 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
204 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
205 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
206 Iterator<GuardExpression> nextGuards = next.getGuards().iterator(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
207 while (nextGuards.hasNext()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
208 GuardExpression nextGuard = nextGuards.next(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
209 boolean implied = false; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
210 for (GuardExpression currentGuard : getGuards()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
211 if (currentGuard.implies(nextGuard)) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
212 implied = true; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
213 break; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
214 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
215 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
216 if (!implied) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
217 return false; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
218 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
219 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
220 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
221 return true; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
222 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
223 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
224 public String createReferenceName() { |
16765
89f635cbd85e
Truffle-DSL: fixed assertions on unspecified toString methods of the annotation processing API.
Christian Humer <christian.humer@gmail.com>
parents:
16759
diff
changeset
|
225 if (getMethod() == null) { |
89f635cbd85e
Truffle-DSL: fixed assertions on unspecified toString methods of the annotation processing API.
Christian Humer <christian.humer@gmail.com>
parents:
16759
diff
changeset
|
226 return "-"; |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
227 } |
16765
89f635cbd85e
Truffle-DSL: fixed assertions on unspecified toString methods of the annotation processing API.
Christian Humer <christian.humer@gmail.com>
parents:
16759
diff
changeset
|
228 return ElementUtils.createReferenceName(getMethod()); |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
229 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
230 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
231 public NodeData getNode() { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
232 return node; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
233 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
234 |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
235 public void setGuards(List<GuardExpression> guards) { |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
236 this.guards = guards; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
237 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
238 |
12395
8e8347ecabbc
Truffle-DSL: implemented new polymorphic more compact generation strategy
Christian Humer <christian.humer@gmail.com>
parents:
11438
diff
changeset
|
239 public boolean isSpecialized() { |
13528
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
240 return kind == SpecializationKind.SPECIALIZED; |
12395
8e8347ecabbc
Truffle-DSL: implemented new polymorphic more compact generation strategy
Christian Humer <christian.humer@gmail.com>
parents:
11438
diff
changeset
|
241 } |
8e8347ecabbc
Truffle-DSL: implemented new polymorphic more compact generation strategy
Christian Humer <christian.humer@gmail.com>
parents:
11438
diff
changeset
|
242 |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
243 public boolean isGeneric() { |
13528
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
244 return kind == SpecializationKind.GENERIC; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
245 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
246 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
247 public boolean isUninitialized() { |
13528
5a0c694ef735
Truffle-DSL: Removed API classes NodeId, NodeContainer and SpecializationListener.
Christian Humer <christian.humer@gmail.com>
parents:
13527
diff
changeset
|
248 return kind == SpecializationKind.UNINITIALIZED; |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
249 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
250 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
251 public List<SpecializationThrowsData> getExceptions() { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
252 return exceptions; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
253 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
254 |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
255 public List<GuardExpression> getGuards() { |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
256 return guards; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
257 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
258 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
259 public void setShortCircuits(List<ShortCircuitData> shortCircuits) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
260 this.shortCircuits = shortCircuits; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
261 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
262 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
263 public List<ShortCircuitData> getShortCircuits() { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
264 return shortCircuits; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
265 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
266 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
267 public List<String> getAssumptions() { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
268 return assumptions; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
269 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
270 |
16759
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
271 public void setAssumptions(List<String> assumptions) { |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
272 this.assumptions = assumptions; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
273 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
274 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
275 public SpecializationData findNextSpecialization() { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
276 List<SpecializationData> specializations = node.getSpecializations(); |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
277 for (int i = 0; i < specializations.size() - 1; i++) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
278 if (specializations.get(i) == this) { |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
279 return specializations.get(i + 1); |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
280 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
281 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
282 return null; |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
283 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
284 |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
285 @Override |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
286 public String toString() { |
13527
25ecb47a6d0e
Truffle-DSL: Added support for references to child arrays in @ShortCircuit;
Christian Humer <christian.humer@gmail.com>
parents:
13271
diff
changeset
|
287 return String.format("%s [id = %s, method = %s, guards = %s, signature = %s]", getClass().getSimpleName(), getId(), getMethod(), getGuards(), getTypeSignature()); |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
288 } |
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
289 |
12399
980db6c0bcd3
Truffle-DSL: fixed invalid @SlowPath on generic execute methods. (GRAAL-490 #resolve)
Christian Humer <christian.humer@gmail.com>
parents:
12395
diff
changeset
|
290 public boolean hasFrame(ProcessorContext context) { |
16759
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
291 for (Parameter param : getParameters()) { |
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
292 if (ElementUtils.typeEquals(param.getType(), context.getTruffleTypes().getFrame())) { |
12399
980db6c0bcd3
Truffle-DSL: fixed invalid @SlowPath on generic execute methods. (GRAAL-490 #resolve)
Christian Humer <christian.humer@gmail.com>
parents:
12395
diff
changeset
|
293 return true; |
980db6c0bcd3
Truffle-DSL: fixed invalid @SlowPath on generic execute methods. (GRAAL-490 #resolve)
Christian Humer <christian.humer@gmail.com>
parents:
12395
diff
changeset
|
294 } |
980db6c0bcd3
Truffle-DSL: fixed invalid @SlowPath on generic execute methods. (GRAAL-490 #resolve)
Christian Humer <christian.humer@gmail.com>
parents:
12395
diff
changeset
|
295 } |
980db6c0bcd3
Truffle-DSL: fixed invalid @SlowPath on generic execute methods. (GRAAL-490 #resolve)
Christian Humer <christian.humer@gmail.com>
parents:
12395
diff
changeset
|
296 return false; |
980db6c0bcd3
Truffle-DSL: fixed invalid @SlowPath on generic execute methods. (GRAAL-490 #resolve)
Christian Humer <christian.humer@gmail.com>
parents:
12395
diff
changeset
|
297 } |
13527
25ecb47a6d0e
Truffle-DSL: Added support for references to child arrays in @ShortCircuit;
Christian Humer <christian.humer@gmail.com>
parents:
13271
diff
changeset
|
298 |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
299 public boolean isReachableAfter(SpecializationData prev) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
300 if (!prev.isSpecialized()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
301 return true; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
302 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
303 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
304 if (!prev.getExceptions().isEmpty()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
305 return true; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
306 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
307 |
16759
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
308 Iterator<Parameter> currentSignature = getSignatureParameters().iterator(); |
23415229349b
Truffle-DSL: new package structure.
Christian Humer <christian.humer@gmail.com>
parents:
16755
diff
changeset
|
309 Iterator<Parameter> prevSignature = prev.getSignatureParameters().iterator(); |
16755
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
310 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
311 while (currentSignature.hasNext() && prevSignature.hasNext()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
312 TypeData currentType = currentSignature.next().getTypeSystemType(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
313 TypeData prevType = prevSignature.next().getTypeSystemType(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
314 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
315 if (!currentType.isImplicitSubtypeOf(prevType)) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
316 return true; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
317 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
318 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
319 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
320 for (String prevAssumption : prev.getAssumptions()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
321 if (!getAssumptions().contains(prevAssumption)) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
322 return true; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
323 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
324 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
325 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
326 Iterator<GuardExpression> prevGuards = prev.getGuards().iterator(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
327 Iterator<GuardExpression> currentGuards = getGuards().iterator(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
328 while (prevGuards.hasNext()) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
329 GuardExpression prevGuard = prevGuards.next(); |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
330 GuardExpression currentGuard = currentGuards.hasNext() ? currentGuards.next() : null; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
331 if (currentGuard == null || !currentGuard.implies(prevGuard)) { |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
332 return true; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
333 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
334 } |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
335 |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
336 return false; |
bd28da642eea
Truffle-DSL: Several new features implemented:
Christian Humer <christian.humer@gmail.com>
parents:
14908
diff
changeset
|
337 } |
10597
79041ab43660
Truffle-DSL: API-change: Renamed truffle.api.codegen to truffle.api.dsl for all projects and packages.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
338 } |