annotate graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java @ 19255:131fb3dd493b

removed unnecessary use of an Assumptions object
author Doug Simon <doug.simon@oracle.com>
date Wed, 11 Feb 2015 13:49:08 +0100
parents f91bf352023a
children a0a760b0fb5f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 */
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
23 package com.oracle.graal.api.code;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25 import java.io.*;
8947
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
26 import java.lang.invoke.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5056
diff changeset
29 import com.oracle.graal.api.meta.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 /**
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
32 * Class for recording assumptions made during compilation. {@link OptimisticAssumption}s can only
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
33 * be recorded in an {@link Assumptions} object if it {@linkplain #useOptimisticAssumptions()
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
34 * allows} them.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 */
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
36 public final class Assumptions implements Serializable, Iterable<Assumptions.Assumption> {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
38 private static final long serialVersionUID = 5152062717588239131L;
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
39
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5711
diff changeset
40 /**
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5711
diff changeset
41 * Abstract base class for assumptions.
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5711
diff changeset
42 */
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 public abstract static class Assumption implements Serializable {
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
44
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
45 private static final long serialVersionUID = -1936652569665112915L;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
48 /**
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
49 * Abstract base class for optimistic assumptions. An optimistic assumption assumes a property
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
50 * of the runtime that may be invalidated by subsequent execution (e.g., that a class has no
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
51 * subclasses implementing {@link NoFinalizableSubclass Object.finalize()}). A non-optimistic
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
52 * assumption assumes a property that will most likely only be invalidated by an external
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
53 * interface to the runtime (e.g., a {@linkplain MethodContents breakpoint is set or a class is
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
54 * redefined}).
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
55 */
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
56 public abstract static class OptimisticAssumption extends Assumption {
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
57
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
58 private static final long serialVersionUID = -1936652569665112932L;
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
59 }
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
60
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
61 /**
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
62 * An optimistic assumption that a given class has no subclasses implementing
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
63 * {@link Object#finalize()}).
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
64 */
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
65 public static final class NoFinalizableSubclass extends OptimisticAssumption {
9012
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
66
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
67 private static final long serialVersionUID = 6451169735564055081L;
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
68
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
69 private ResolvedJavaType receiverType;
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
70
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
71 public NoFinalizableSubclass(ResolvedJavaType receiverType) {
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
72 this.receiverType = receiverType;
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
73 }
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
74
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
75 @Override
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
76 public int hashCode() {
9125
5b25562f8bd7 assumptions: simplify hashCode()
Bernhard Urban <bernhard.urban@jku.at>
parents: 9012
diff changeset
77 return 31 + receiverType.hashCode();
9012
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
78 }
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
79
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
80 @Override
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
81 public boolean equals(Object obj) {
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
82 if (obj instanceof NoFinalizableSubclass) {
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
83 NoFinalizableSubclass other = (NoFinalizableSubclass) obj;
14160
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14157
diff changeset
84 return other.receiverType.equals(receiverType);
9012
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
85 }
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
86 return false;
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
87 }
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
88
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
89 @Override
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
90 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
91 return "NoFinalizableSubclass[receiverType=" + receiverType.toJavaName() + "]";
9012
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
92 }
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
93
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
94 }
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
95
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 /**
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
97 * An optimistic assumption that a given type has a given unique subtype.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98 */
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
99 public static final class ConcreteSubtype extends OptimisticAssumption {
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
100
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
101 private static final long serialVersionUID = -1457173265437676252L;
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
102
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
103 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104 * Type the assumption is made about.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 */
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
106 public final ResolvedJavaType context;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 * Assumed unique concrete sub-type of the context type.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110 */
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
111 public final ResolvedJavaType subtype;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
112
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
113 public ConcreteSubtype(ResolvedJavaType context, ResolvedJavaType subtype) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
114 this.context = context;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
115 this.subtype = subtype;
18823
5a21cac1968f Add utilities ModifiersProvider#isConcrete, ResolvedJavaMethod#hasReceiver, ResolvedJavaMethod#hasBytecodes to Graal API.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18499
diff changeset
116 assert subtype.isConcrete() : subtype.toString() + " : " + context.toString();
16476
92f75d104b4b moved getElementalType() from MetaUtil to be a default method in JavaType
Doug Simon <doug.simon@oracle.com>
parents: 15729
diff changeset
117 assert !subtype.isArray() || subtype.getElementalType().isFinal() : subtype.toString() + " : " + context.toString();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
118 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 public int hashCode() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122 final int prime = 31;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123 int result = 1;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
124 result = prime * result + context.hashCode();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
125 result = prime * result + subtype.hashCode();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
126 return result;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
127 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
128
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 public boolean equals(Object obj) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 if (obj instanceof ConcreteSubtype) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132 ConcreteSubtype other = (ConcreteSubtype) obj;
14160
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14157
diff changeset
133 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
134 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135 return false;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136 }
7086
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
137
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
138 @Override
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
139 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
140 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
141 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 /**
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
145 * An optimistic 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
146 */
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
147 public static final class ConcreteMethod extends OptimisticAssumption {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
148
4142
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
149 private static final long serialVersionUID = -7636746737947390059L;
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
150
bc8527f3071c Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3733
diff changeset
151 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7223
diff changeset
152 * 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
153 * {@link #context} is {@link #impl}.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
154 */
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
155 public final ResolvedJavaMethod method;
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 * A receiver type.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
159 */
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
160 public final ResolvedJavaType context;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
161
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
163 * 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
164 */
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
165 public final ResolvedJavaMethod impl;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
166
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
167 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
168 this.method = method;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
169 this.context = context;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
170 this.impl = impl;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
171 }
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 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
174 public int hashCode() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
175 final int prime = 31;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176 int result = 1;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177 result = prime * result + method.hashCode();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178 result = prime * result + context.hashCode();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
179 result = prime * result + impl.hashCode();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
180 return result;
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
183 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
184 public boolean equals(Object obj) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
185 if (obj instanceof ConcreteMethod) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
186 ConcreteMethod other = (ConcreteMethod) obj;
14160
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14157
diff changeset
187 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
188 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
189 return false;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190 }
7086
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
191
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
192 @Override
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
193 public String toString() {
19250
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
194 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
195 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
196 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
197
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
198 /**
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
199 * An non-optimistic assumption that the bytecodes of a given method used during compilation
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
200 * will not change. This kind of dependency may be used to invalidate and deoptimize compiled
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
201 * code when:
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
202 * <ul>
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
203 * <li>one of its constituent methods is redefined or</li>
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
204 * <li>a breakpoint is set in one of its constituent methods and the runtime only implements
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
205 * breakpoint support in non-compiled code.
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
206 * </ul>
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
207 */
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
208 public static final class MethodContents extends Assumption {
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
209
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
210 private static final long serialVersionUID = -4821594103928571659L;
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
211
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
212 public final ResolvedJavaMethod method;
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
213
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
214 public MethodContents(ResolvedJavaMethod method) {
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
215 this.method = method;
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
216 }
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
217
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
218 @Override
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
219 public int hashCode() {
9125
5b25562f8bd7 assumptions: simplify hashCode()
Bernhard Urban <bernhard.urban@jku.at>
parents: 9012
diff changeset
220 return 31 + method.hashCode();
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
221 }
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
222
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
223 @Override
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
224 public boolean equals(Object obj) {
14157
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 10663
diff changeset
225 if (obj instanceof MethodContents) {
8c4a3d9308a7 fixed FindBugs bugs
twisti
parents: 10663
diff changeset
226 MethodContents other = (MethodContents) obj;
14160
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14157
diff changeset
227 return other.method.equals(method);
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
228 }
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
229 return false;
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
230 }
7086
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
231
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
232 @Override
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
233 public String toString() {
19250
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
234 return "MethodContents[method=" + method.format("%H.%n(%p)%r") + "]";
7086
902f60aa20cc added toString() implementation to Assumption classes
Doug Simon <doug.simon@oracle.com>
parents: 7064
diff changeset
235 }
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
236 }
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
237
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
238 /**
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
239 * An optimistic assumption that a given call site's method handle did not change.
8947
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
240 */
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
241 public static final class CallSiteTargetValue extends OptimisticAssumption {
8947
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
242
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
243 private static final long serialVersionUID = 1732459941784550371L;
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
244
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
245 public final CallSite callSite;
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
246 public final MethodHandle methodHandle;
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
247
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
248 public CallSiteTargetValue(CallSite callSite, MethodHandle methodHandle) {
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
249 this.callSite = callSite;
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
250 this.methodHandle = methodHandle;
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
251 }
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
252
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
253 @Override
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
254 public int hashCode() {
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
255 final int prime = 31;
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
256 int result = 1;
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
257 result = prime * result + callSite.hashCode();
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
258 result = prime * result + methodHandle.hashCode();
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
259 return result;
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
260 }
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
261
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
262 @Override
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
263 public boolean equals(Object obj) {
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
264 if (obj instanceof CallSiteTargetValue) {
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
265 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
266 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
267 }
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
268 return false;
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
269 }
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
270
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
271 @Override
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
272 public String toString() {
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
273 return "CallSiteTargetValue[callSite=" + callSite + ", methodHandle=" + methodHandle + "]";
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
274 }
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
275 }
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 7645
diff changeset
276
19252
f91bf352023a replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
277 private Set<Assumption> assumptions;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
278
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
279 /**
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
280 * Specifies whether {@link OptimisticAssumption}s can be made.
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
281 */
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
282 private boolean allowOptimisticAssumptions;
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
283
19250
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
284 public static final boolean ALLOW_OPTIMISTIC_ASSUMPTIONS = true;
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
285 public static final boolean DONT_ALLOW_OPTIMISTIC_ASSUMPTIONS = false;
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
286
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
287 /**
19250
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
288 * Creates an object for recording assumptions.
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
289 *
19250
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
290 * @param allowOptimisticAssumptions specifies whether {@link OptimisticAssumption}s can be
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
291 * recorded in this object
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
292 */
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
293 public Assumptions(boolean allowOptimisticAssumptions) {
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
294 this.allowOptimisticAssumptions = allowOptimisticAssumptions;
19252
f91bf352023a replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
295 assumptions = new HashSet<>();
7064
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6329
diff changeset
296 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
297
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
298 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
299 * Returns whether any assumptions have been registered.
15729
59a85df7a418 Add some assertions and tests to TestResolvedJavaType.findUniqueConcreteSubtypeTest
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14160
diff changeset
300 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
301 * @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
302 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
303 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
304 return assumptions.isEmpty();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
305 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
306
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
307 /**
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
308 * Determines whether {@link OptimisticAssumption}s can be made.
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
309 */
7064
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6329
diff changeset
310 public boolean useOptimisticAssumptions() {
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
311 return allowOptimisticAssumptions;
7064
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6329
diff changeset
312 }
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6329
diff changeset
313
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
314 @Override
18342
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
315 public int hashCode() {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
316 throw new UnsupportedOperationException("hashCode");
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
317 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
318
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
319 @Override
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
320 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
321 if (this == obj) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
322 return true;
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 if (obj instanceof Assumptions) {
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
325 Assumptions that = (Assumptions) obj;
19252
f91bf352023a replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
326 if (this.allowOptimisticAssumptions != that.allowOptimisticAssumptions || !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
327 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
328 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
329 return true;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
330 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
331 return false;
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
332 }
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
333
d60dd21329f2 implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents: 16480
diff changeset
334 @Override
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
335 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
336 return assumptions.iterator();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
337 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
338
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
339 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
340 * 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: 14160
diff changeset
341 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
342 * @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
343 */
9012
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
344 public void recordNoFinalizableSubclassAssumption(ResolvedJavaType receiverType) {
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 8947
diff changeset
345 record(new NoFinalizableSubclass(receiverType));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
346 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
347
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
348 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7223
diff changeset
349 * 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
350 * {@code context}.
15729
59a85df7a418 Add some assertions and tests to TestResolvedJavaType.findUniqueConcreteSubtypeTest
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14160
diff changeset
351 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
352 * @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
353 * @param subtype the one concrete subtype
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
354 */
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
355 public void recordConcreteSubtype(ResolvedJavaType context, ResolvedJavaType subtype) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
356 record(new ConcreteSubtype(context, subtype));
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
357 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
358
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
359 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
360 * 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
361 * {@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: 14160
diff changeset
362 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
363 * @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
364 * @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
365 * @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
366 */
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
367 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
368 record(new ConcreteMethod(method, context, impl));
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
369 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
370
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
371 /**
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
372 * Records that {@code method} was used during the compilation.
15729
59a85df7a418 Add some assertions and tests to TestResolvedJavaType.findUniqueConcreteSubtypeTest
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14160
diff changeset
373 *
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
374 * @param method a method whose contents were used
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
375 */
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
376 public void recordMethodContents(ResolvedJavaMethod method) {
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
377 record(new MethodContents(method));
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
378 }
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4199
diff changeset
379
7223
e2ea829fafd9 use CHA more frequently for inlining
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7220
diff changeset
380 public void record(Assumption assumption) {
19249
ec8402f4e00a introduced OptimisiticAssumption base class and improved javadoc in Assumptions API
Doug Simon <doug.simon@oracle.com>
parents: 18823
diff changeset
381 assert allowOptimisticAssumptions || !(assumption instanceof OptimisticAssumption) : "cannot make optimistic assumption: " + assumption;
19252
f91bf352023a replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
382 assumptions.add(assumption);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
383 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
384
19250
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
385 /**
19251
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 19250
diff changeset
386 * 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
387 */
19255
131fb3dd493b removed unnecessary use of an Assumptions object
Doug Simon <doug.simon@oracle.com>
parents: 19252
diff changeset
388 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
389 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
390 }
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
391
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
392 /**
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
393 * 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
394 */
19252
f91bf352023a replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
395 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
396 assert other != this;
f91bf352023a replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
397 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
398 }
10611
1546866ebb8d First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9841
diff changeset
399
19250
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
400 @Override
8ab925a6f724 made Assumptions be part of a StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19249
diff changeset
401 public String toString() {
19252
f91bf352023a replaced use of expandable array with HashSet for recording assumptions
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
402 return "Assumptions{optimistic=" + allowOptimisticAssumptions + ", assumptions=" + assumptions + "}";
10611
1546866ebb8d First draft of Truffle graph caching.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9841
diff changeset
403 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
404 }