Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Assumptions.java @ 24155:88bd5f7522a1 jvmci-0.30
update hgignore and undo change to hotspot/.project
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 07 Jul 2017 15:08:58 +0200 |
parents | bd8c5c264c42 |
children |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
23 package jdk.vm.ci.meta; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22480
diff
changeset
|
25 import java.lang.invoke.CallSite; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22480
diff
changeset
|
26 import java.lang.invoke.MethodHandle; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22480
diff
changeset
|
27 import java.util.Arrays; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22480
diff
changeset
|
28 import java.util.HashSet; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22480
diff
changeset
|
29 import java.util.Iterator; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22480
diff
changeset
|
30 import java.util.Set; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 /** |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
33 * Class for recording assumptions made during compilation. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 */ |
21411
082417ac43e4
removed com.oracle.graal.hotspot.server and uses of Serializable it depended upon (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21368
diff
changeset
|
35 public final class Assumptions implements Iterable<Assumptions.Assumption> { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
36 |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5711
diff
changeset
|
37 /** |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
38 * Abstract base class for assumptions. An assumption assumes a property of the runtime that may |
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
39 * be invalidated by subsequent execution (e.g., that a class has no subclasses implementing |
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
40 * {@link NoFinalizableSubclass Object.finalize()}). |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5711
diff
changeset
|
41 */ |
21411
082417ac43e4
removed com.oracle.graal.hotspot.server and uses of Serializable it depended upon (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21368
diff
changeset
|
42 public abstract static class Assumption { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 |
19249
ec8402f4e00a
introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents:
18823
diff
changeset
|
45 /** |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
46 * A class for providing information that is only valid in association with a set of |
23349 | 47 * {@link Assumption}s. It is permissible for AssumptionResults to have no assumptions at all. |
48 * For instance, if {@link ResolvedJavaType#isLeaf()} returns true for a type | |
23340
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
49 * {@link ResolvedJavaType#findLeafConcreteSubtype()} can return an AssumptionResult with no |
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
50 * assumptions since the leaf information is statically true. |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
51 * |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
52 * @param <T> |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
53 */ |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
54 public static class AssumptionResult<T> { |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
55 Assumption[] assumptions; |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
56 final T result; |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
57 |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
58 private static final Assumption[] EMPTY = new Assumption[0]; |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
59 |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
60 public AssumptionResult(T result, Assumption... assumptions) { |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
61 this.result = result; |
20008
b47d7ebcfa4e
Don't bother cloning assumptions array
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19801
diff
changeset
|
62 this.assumptions = assumptions; |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
63 } |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
64 |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
65 public AssumptionResult(T result) { |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
66 this(result, EMPTY); |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
67 } |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
68 |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
69 public T getResult() { |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
70 return result; |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
71 } |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
72 |
21368
d256b81b6335
Optimize assumption-free checks when compiling without optimistic optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20008
diff
changeset
|
73 public boolean isAssumptionFree() { |
d256b81b6335
Optimize assumption-free checks when compiling without optimistic optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20008
diff
changeset
|
74 return assumptions.length == 0; |
d256b81b6335
Optimize assumption-free checks when compiling without optimistic optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20008
diff
changeset
|
75 } |
d256b81b6335
Optimize assumption-free checks when compiling without optimistic optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
20008
diff
changeset
|
76 |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
77 public void add(AssumptionResult<T> other) { |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
78 Assumption[] newAssumptions = Arrays.copyOf(this.assumptions, this.assumptions.length + other.assumptions.length); |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
79 System.arraycopy(other.assumptions, 0, newAssumptions, this.assumptions.length, other.assumptions.length); |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
80 this.assumptions = newAssumptions; |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
81 } |
22480
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
82 |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
83 public boolean canRecordTo(Assumptions target) { |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
84 /* |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
85 * We can use the result if it is either assumption free, or if we have a valid |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
86 * Assumptions object where we can record assumptions. |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
87 */ |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
88 return assumptions.length == 0 || target != null; |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
89 } |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
90 |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
91 public void recordTo(Assumptions target) { |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
92 assert canRecordTo(target); |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
93 |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
94 if (assumptions.length > 0) { |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
95 for (Assumption assumption : assumptions) { |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
96 target.record(assumption); |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
97 } |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
98 } |
f9a6a2f0b414
Invert logic for recording the assumptions of an AssumptionResult to Assumptions; this allows using assumption-free AssumptionResults when compiling without speculative optimizations
Christian Wimmer <christian.wimmer@oracle.com>
parents:
22054
diff
changeset
|
99 } |
19800
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
100 } |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
101 |
3362ba500371
Connect required Assumptions with answer to CHA query
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19306
diff
changeset
|
102 /** |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
103 * An assumption that a given class has no subclasses implementing {@link Object#finalize()}). |
19249
ec8402f4e00a
introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents:
18823
diff
changeset
|
104 */ |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
105 public static final class NoFinalizableSubclass extends Assumption { |
9012
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
106 |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
107 private ResolvedJavaType receiverType; |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
108 |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
109 public NoFinalizableSubclass(ResolvedJavaType receiverType) { |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
110 this.receiverType = receiverType; |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
111 } |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
112 |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
113 @Override |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
114 public int hashCode() { |
9125
5b25562f8bd7
assumptions: simplify hashCode()
Bernhard Urban <bernhard.urban@jku.at>
parents:
9012
diff
changeset
|
115 return 31 + receiverType.hashCode(); |
9012
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
116 } |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
117 |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
118 @Override |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
119 public boolean equals(Object obj) { |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
120 if (obj instanceof NoFinalizableSubclass) { |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
121 NoFinalizableSubclass other = (NoFinalizableSubclass) obj; |
14158
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14157
diff
changeset
|
122 return other.receiverType.equals(receiverType); |
9012
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
123 } |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
124 return false; |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
125 } |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
126 |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
127 @Override |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
128 public String toString() { |
16479
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
129 return "NoFinalizableSubclass[receiverType=" + receiverType.toJavaName() + "]"; |
9012
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
130 } |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
131 |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
132 } |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
133 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 /** |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
135 * An assumption that a given abstract or interface type has one direct concrete subtype. There |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
136 * is no requirement that the subtype is a leaf type. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
137 */ |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
138 public static final class ConcreteSubtype extends Assumption { |
4670
41034914e2ee
add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents:
4199
diff
changeset
|
139 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
140 /** |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
141 * Type the assumption is made about. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 */ |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
143 public final ResolvedJavaType context; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 /** |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
146 * Assumed concrete sub-type of the context type. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 */ |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
148 public final ResolvedJavaType subtype; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
150 public ConcreteSubtype(ResolvedJavaType context, ResolvedJavaType subtype) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
151 this.context = context; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 this.subtype = subtype; |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
153 assert context.isAbstract(); |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
154 assert subtype.isConcrete() || context.isInterface() : subtype.toString() + " : " + context.toString(); |
22032
d1a41fbfcfd2
Replace ResolvedJavaType.isFinal with more meaningful and correct isLeaf
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21798
diff
changeset
|
155 assert !subtype.isArray() || subtype.getElementalType().isFinalFlagSet() : subtype.toString() + " : " + context.toString(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
158 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 public int hashCode() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 final int prime = 31; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
161 int result = 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
162 result = prime * result + context.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 result = prime * result + subtype.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
164 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 public boolean equals(Object obj) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 if (obj instanceof ConcreteSubtype) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 ConcreteSubtype other = (ConcreteSubtype) obj; |
14158
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14157
diff
changeset
|
171 return other.context.equals(context) && other.subtype.equals(subtype); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
173 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
174 } |
7086
902f60aa20cc
added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents:
7064
diff
changeset
|
175 |
902f60aa20cc
added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents:
7064
diff
changeset
|
176 @Override |
902f60aa20cc
added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents:
7064
diff
changeset
|
177 public String toString() { |
16479
558cf39c646b
moved toJavaName(JavaType type) from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents:
16476
diff
changeset
|
178 return "ConcreteSubtype[context=" + context.toJavaName() + ", subtype=" + subtype.toJavaName() + "]"; |
7086
902f60aa20cc
added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents:
7064
diff
changeset
|
179 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
180 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
181 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 /** |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
183 * An assumption that a given type has no subtypes. |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
184 */ |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
185 public static final class LeafType extends Assumption { |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
186 |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
187 /** |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
188 * Type the assumption is made about. |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
189 */ |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
190 public final ResolvedJavaType context; |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
191 |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
192 public LeafType(ResolvedJavaType context) { |
23340
22c3bdf28fff
Don't generate LeafType assumptions for isLeaf == true types
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22672
diff
changeset
|
193 assert !context.isLeaf() : "assumption isn't required for leaf types"; |
19801
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
194 this.context = context; |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
195 } |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
196 |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
197 @Override |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
198 public int hashCode() { |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
199 final int prime = 31; |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
200 int result = 1; |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
201 result = prime * result + context.hashCode(); |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
202 return result; |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
203 } |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
204 |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
205 @Override |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
206 public boolean equals(Object obj) { |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
207 if (obj instanceof LeafType) { |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
208 LeafType other = (LeafType) obj; |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
209 return other.context.equals(context); |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
210 } |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
211 return false; |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
212 } |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
213 |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
214 @Override |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
215 public String toString() { |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
216 return "LeafSubtype[context=" + context.toJavaName() + "]"; |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
217 } |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
218 } |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
219 |
deab43a789ad
Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
19800
diff
changeset
|
220 /** |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
221 * An assumption that a given virtual method has a given unique implementation. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 */ |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
223 public static final class ConcreteMethod extends Assumption { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
225 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7223
diff
changeset
|
226 * A virtual (or interface) method whose unique implementation for the receiver type in |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7223
diff
changeset
|
227 * {@link #context} is {@link #impl}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 */ |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
229 public final ResolvedJavaMethod method; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
231 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 * A receiver type. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
233 */ |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
234 public final ResolvedJavaType context; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 * The unique implementation of {@link #method} for {@link #context}. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
238 */ |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
239 public final ResolvedJavaMethod impl; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
240 |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
241 public ConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType context, ResolvedJavaMethod impl) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 this.method = method; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 this.context = context; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
244 this.impl = impl; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
245 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
248 public int hashCode() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
249 final int prime = 31; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
250 int result = 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
251 result = prime * result + method.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
252 result = prime * result + context.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 result = prime * result + impl.hashCode(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 public boolean equals(Object obj) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
259 if (obj instanceof ConcreteMethod) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 ConcreteMethod other = (ConcreteMethod) obj; |
14158
fd7fcd2d2072
replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents:
14157
diff
changeset
|
261 return other.method.equals(method) && other.context.equals(context) && other.impl.equals(impl); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
262 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 return false; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 } |
7086
902f60aa20cc
added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents:
7064
diff
changeset
|
265 |
902f60aa20cc
added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents:
7064
diff
changeset
|
266 @Override |
902f60aa20cc
added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents:
7064
diff
changeset
|
267 public String toString() { |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
268 return "ConcreteMethod[method=" + method.format("%H.%n(%p)%r") + ", context=" + context.toJavaName() + ", impl=" + impl.format("%H.%n(%p)%r") + "]"; |
7086
902f60aa20cc
added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents:
7064
diff
changeset
|
269 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
270 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
271 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
272 /** |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
273 * An assumption that a given call site's method handle did not change. |
4670
41034914e2ee
add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents:
4199
diff
changeset
|
274 */ |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
275 public static final class CallSiteTargetValue extends Assumption { |
8947
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
276 |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
277 public final CallSite callSite; |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
278 public final MethodHandle methodHandle; |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
279 |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
280 public CallSiteTargetValue(CallSite callSite, MethodHandle methodHandle) { |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
281 this.callSite = callSite; |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
282 this.methodHandle = methodHandle; |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
283 } |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
284 |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
285 @Override |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
286 public int hashCode() { |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
287 final int prime = 31; |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
288 int result = 1; |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
289 result = prime * result + callSite.hashCode(); |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
290 result = prime * result + methodHandle.hashCode(); |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
291 return result; |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
292 } |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
293 |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
294 @Override |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
295 public boolean equals(Object obj) { |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
296 if (obj instanceof CallSiteTargetValue) { |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
297 CallSiteTargetValue other = (CallSiteTargetValue) obj; |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
298 return callSite.equals(other.callSite) && methodHandle.equals(other.methodHandle); |
8947
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
299 } |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
300 return false; |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
301 } |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
302 |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
303 @Override |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
304 public String toString() { |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
305 return "CallSiteTargetValue[callSite=" + callSite + ", methodHandle=" + methodHandle + "]"; |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
306 } |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
307 } |
707b20dd9512
draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents:
7645
diff
changeset
|
308 |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
309 private final Set<Assumption> assumptions = new HashSet<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
310 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
311 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
312 * Returns whether any assumptions have been registered. |
15729
59a85df7a418
Add some assertions and tests to TestResolvedJavaType.findUniqueConcreteSubtypeTest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14158
diff
changeset
|
313 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
314 * @return {@code true} if at least one assumption has been registered, {@code false} otherwise. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
315 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
316 public boolean isEmpty() { |
19252
f91bf352023a
replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents:
19251
diff
changeset
|
317 return assumptions.isEmpty(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
319 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
320 @Override |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
321 public int hashCode() { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
322 throw new UnsupportedOperationException("hashCode"); |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
323 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
324 |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
325 @Override |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
326 public boolean equals(Object obj) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
327 if (this == obj) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
328 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
329 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
330 if (obj instanceof Assumptions) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
331 Assumptions that = (Assumptions) obj; |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
332 if (!this.assumptions.equals(that.assumptions)) { |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
333 return false; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
334 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
335 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
336 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
337 return false; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
338 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
339 |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16480
diff
changeset
|
340 @Override |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
341 public Iterator<Assumption> iterator() { |
19252
f91bf352023a
replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents:
19251
diff
changeset
|
342 return assumptions.iterator(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
343 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
344 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
345 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
346 * Records an assumption that the specified type has no finalizable subclasses. |
15729
59a85df7a418
Add some assertions and tests to TestResolvedJavaType.findUniqueConcreteSubtypeTest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14158
diff
changeset
|
347 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
348 * @param receiverType the type that is assumed to have no finalizable subclasses |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
349 */ |
9012
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
350 public void recordNoFinalizableSubclassAssumption(ResolvedJavaType receiverType) { |
2979aaac95af
assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents:
8947
diff
changeset
|
351 record(new NoFinalizableSubclass(receiverType)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
352 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
354 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7223
diff
changeset
|
355 * Records that {@code subtype} is the only concrete subtype in the class hierarchy below |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7223
diff
changeset
|
356 * {@code context}. |
15729
59a85df7a418
Add some assertions and tests to TestResolvedJavaType.findUniqueConcreteSubtypeTest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14158
diff
changeset
|
357 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
358 * @param context the root of the subtree of the class hierarchy that this assumptions is about |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
359 * @param subtype the one concrete subtype |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
360 */ |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
361 public void recordConcreteSubtype(ResolvedJavaType context, ResolvedJavaType subtype) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
362 record(new ConcreteSubtype(context, subtype)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
363 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
364 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
365 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
366 * Records that {@code impl} is the only possible concrete target for a virtual call to |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
367 * {@code method} with a receiver of type {@code context}. |
15729
59a85df7a418
Add some assertions and tests to TestResolvedJavaType.findUniqueConcreteSubtypeTest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
14158
diff
changeset
|
368 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
369 * @param method a method that is the target of a virtual call |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
370 * @param context the receiver type of a call to {@code method} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
371 * @param impl the concrete method that is the only possible target for the virtual call |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
372 */ |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
373 public void recordConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType context, ResolvedJavaMethod impl) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
374 record(new ConcreteMethod(method, context, impl)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
375 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
376 |
7223
e2ea829fafd9
use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7220
diff
changeset
|
377 public void record(Assumption assumption) { |
19252
f91bf352023a
replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents:
19251
diff
changeset
|
378 assumptions.add(assumption); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
379 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
380 |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
381 /** |
19251
063e8873bd14
changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents:
19250
diff
changeset
|
382 * Gets a copy of the assumptions recorded in this object as an array. |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
383 */ |
19255
131fb3dd493b
removed unnecessary use of an Assumptions object
Doug Simon <doug.simon@oracle.com>
parents:
19252
diff
changeset
|
384 public Assumption[] toArray() { |
19252
f91bf352023a
replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents:
19251
diff
changeset
|
385 return assumptions.toArray(new Assumption[assumptions.size()]); |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
386 } |
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
387 |
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
388 /** |
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
389 * Copies assumptions recorded by another {@link Assumptions} object into this object. |
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
390 */ |
19252
f91bf352023a
replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents:
19251
diff
changeset
|
391 public void record(Assumptions other) { |
f91bf352023a
replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents:
19251
diff
changeset
|
392 assert other != this; |
f91bf352023a
replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents:
19251
diff
changeset
|
393 assumptions.addAll(other.assumptions); |
9699
9529ab567367
Drafted version of an inlining policy that uses the callee graph size as its metric.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9125
diff
changeset
|
394 } |
10611
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9841
diff
changeset
|
395 |
19250
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
396 @Override |
8ab925a6f724
made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19249
diff
changeset
|
397 public String toString() { |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
19255
diff
changeset
|
398 return "Assumptions[" + assumptions + "]"; |
10611
1546866ebb8d
First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
9841
diff
changeset
|
399 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 } |