annotate graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java @ 16324:cb196ea71d77

[SPARC] Fixing last issues on jtt.bytecode, reverting changes to HexCodeFile, fixed parsing method in Disassembler and submitted the patch
author Stefan Anzinger <stefan.anzinger@gmail.com>
date Fri, 06 Jun 2014 00:18:30 +0200
parents f57cf459f5d3
children 41d479400da8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
1 /*
13999
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
4 *
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
7 * published by the Free Software Foundation.
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
8 *
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
13 * accompanied this code).
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
14 *
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
18 *
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
21 * questions.
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
22 */
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
23 package com.oracle.graal.compiler.common.type;
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
24
11384
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
25 import java.util.*;
9786
6c1f7b853d35 Generalize the code for detecting invalid stamps in join operations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
26
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5504
diff changeset
27 import com.oracle.graal.api.meta.*;
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
28
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
29 public abstract class AbstractObjectStamp extends Stamp {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
30
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: 5540
diff changeset
31 private final ResolvedJavaType type;
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
32 private final boolean exactType;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
33 private final boolean nonNull;
5831
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
34 private final boolean alwaysNull;
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
35
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
36 protected AbstractObjectStamp(ResolvedJavaType type, boolean exactType, boolean nonNull, boolean alwaysNull) {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
37 this.type = type;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
38 this.exactType = exactType;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
39 this.nonNull = nonNull;
5831
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
40 this.alwaysNull = alwaysNull;
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
41 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
42
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
43 protected abstract AbstractObjectStamp copyWith(ResolvedJavaType newType, boolean newExactType, boolean newNonNull, boolean newAlwaysNull);
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
44
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
45 @Override
13999
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
46 public Stamp unrestricted() {
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
47 return copyWith(null, false, false, false);
13999
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
48 }
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
49
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
50 @Override
14997
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
51 public Stamp illegal() {
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
52 return copyWith(null, true, true, false);
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
53 }
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
54
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
55 @Override
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
56 public Stamp constant(Constant c, MetaAccessProvider meta) {
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
57 ResolvedJavaType constType = c.isNull() ? null : meta.lookupJavaType(c);
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
58 return copyWith(constType, c.isNonNull(), c.isNonNull(), c.isNull());
14997
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
59 }
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
60
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
61 @Override
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
62 public boolean isLegal() {
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
63 return !exactType || (type != null && (isConcreteType(type)));
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
64 }
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
65
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
66 @Override
13999
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
67 public Kind getStackKind() {
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
68 return Kind.Object;
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
69 }
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
70
f2b300c6e621 Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents: 13609
diff changeset
71 @Override
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7097
diff changeset
72 public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7097
diff changeset
73 if (type != null) {
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7097
diff changeset
74 return type;
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7097
diff changeset
75 }
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7097
diff changeset
76 return metaAccess.lookupJavaType(Object.class);
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7097
diff changeset
77 }
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7097
diff changeset
78
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
79 public boolean nonNull() {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
80 return nonNull;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
81 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
82
5831
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
83 public boolean alwaysNull() {
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
84 return alwaysNull;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
85 }
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
86
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: 5540
diff changeset
87 public ResolvedJavaType type() {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
88 return type;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
89 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
90
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
91 public boolean isExactType() {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
92 return exactType;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
93 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
94
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
95 protected void appendString(StringBuilder str) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5890
diff changeset
96 str.append(nonNull ? "!" : "").append(exactType ? "#" : "").append(' ').append(type == null ? "-" : type.getName()).append(alwaysNull ? " NULL" : "");
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
97 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
98
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
99 @Override
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
100 public Stamp meet(Stamp otherStamp) {
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
101 if (this == otherStamp) {
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
102 return this;
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
103 }
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
104 if (!isCompatible(otherStamp)) {
11387
9088d13767f3 Keep a kind in the illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11386
diff changeset
105 return StampFactory.illegal(Kind.Illegal);
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
106 }
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
107 AbstractObjectStamp other = (AbstractObjectStamp) otherStamp;
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
108 if (!isLegal()) {
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
109 return other;
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
110 } else if (!other.isLegal()) {
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
111 return this;
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
112 }
5831
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
113 ResolvedJavaType meetType;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
114 boolean meetExactType;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
115 boolean meetNonNull;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
116 boolean meetAlwaysNull;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
117 if (other.alwaysNull) {
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
118 meetType = type();
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
119 meetExactType = exactType;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
120 meetNonNull = false;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
121 meetAlwaysNull = alwaysNull;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
122 } else if (alwaysNull) {
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
123 meetType = other.type();
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
124 meetExactType = other.exactType;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
125 meetNonNull = false;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
126 meetAlwaysNull = other.alwaysNull;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
127 } else {
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
128 meetType = meetTypes(type(), other.type());
14997
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
129 meetExactType = exactType && other.exactType;
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
130 if (meetExactType && type != null && other.type != null) {
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
131 // meeting two valid exact types may result in a non-exact type
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
132 meetExactType = Objects.equals(meetType, type) && Objects.equals(meetType, other.type);
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
133 }
5831
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
134 meetNonNull = nonNull && other.nonNull;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
135 meetAlwaysNull = false;
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5830
diff changeset
136 }
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
137
14158
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14003
diff changeset
138 if (Objects.equals(meetType, type) && meetExactType == exactType && meetNonNull == nonNull && meetAlwaysNull == alwaysNull) {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
139 return this;
14158
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14003
diff changeset
140 } else if (Objects.equals(meetType, other.type) && meetExactType == other.exactType && meetNonNull == other.nonNull && meetAlwaysNull == other.alwaysNull) {
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
141 return other;
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
142 } else {
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
143 return copyWith(meetType, meetExactType, meetNonNull, meetAlwaysNull);
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
144 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
145 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
146
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
147 @Override
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
148 public Stamp join(Stamp otherStamp) {
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
149 return join0(otherStamp, false);
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
150 }
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
151
11384
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
152 /**
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
153 * Returns the stamp representing the type of this stamp after a cast to the type represented by
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
154 * the {@code to} stamp. While this is very similar to a {@link #join} operation, in the case
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
155 * where both types are not obviously related, the cast operation will prefer the type of the
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
156 * {@code to} stamp. This is necessary as long as ObjectStamps are not able to accurately
11394
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
157 * represent intersection types.
14997
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
158 *
11384
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
159 * For example when joining the {@link RandomAccess} type with the {@link AbstractList} type,
11394
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
160 * without intersection types, this would result in the most generic type ({@link Object} ). For
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
161 * this reason, in some cases a {@code castTo} operation is preferable in order to keep at least
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
162 * the {@link AbstractList} type.
14997
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
163 *
11384
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
164 * @param to the stamp this stamp should be casted to
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
165 * @return This stamp casted to the {@code to} stamp
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
166 */
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
167 public Stamp castTo(ObjectStamp to) {
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
168 return join0(to, true);
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
169 }
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
170
11384
5e99a0628192 Add javadoc for ObjectStamp.castTo. Fix javadoc typo.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11265
diff changeset
171 private Stamp join0(Stamp otherStamp, boolean castToOther) {
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
172 if (this == otherStamp) {
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
173 return this;
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
174 }
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
175 if (!isCompatible(otherStamp)) {
11387
9088d13767f3 Keep a kind in the illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11386
diff changeset
176 return StampFactory.illegal(Kind.Illegal);
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
177 }
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
178 AbstractObjectStamp other = (AbstractObjectStamp) otherStamp;
14997
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
179 if (!isLegal()) {
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
180 return this;
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
181 } else if (!other.isLegal()) {
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
182 return other;
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
183 }
5e4ae8709830 Use typed illegal stamps and use IllegalStamp only for conflicting primitive types.
Roland Schatz <roland.schatz@oracle.com>
parents: 14158
diff changeset
184
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
185 ResolvedJavaType joinType;
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
186 boolean joinAlwaysNull = alwaysNull || other.alwaysNull;
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
187 boolean joinNonNull = nonNull || other.nonNull;
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
188 boolean joinExactType = exactType || other.exactType;
14158
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14003
diff changeset
189 if (Objects.equals(type, other.type)) {
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
190 joinType = type;
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
191 } else if (type == null && other.type == null) {
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
192 joinType = null;
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
193 } else if (type == null) {
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
194 joinType = other.type;
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
195 } else if (other.type == null) {
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
196 joinType = type;
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
197 } else {
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
198 // both types are != null and different
7097
6644cecbd3a7 Replace ResolvedJavaType.isAssignableTo with isAssignableFrom to be consistent with java.lang.Class
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7037
diff changeset
199 if (type.isAssignableFrom(other.type)) {
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
200 joinType = other.type;
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
201 if (exactType) {
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
202 joinAlwaysNull = true;
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
203 }
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
204 } else if (other.type.isAssignableFrom(type)) {
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
205 joinType = type;
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
206 if (other.exactType) {
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
207 joinAlwaysNull = true;
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
208 }
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
209 } else {
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
210 if (castToOther) {
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
211 joinType = other.type;
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
212 joinExactType = other.exactType;
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
213 } else {
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
214 joinType = null;
11386
366136516cc6 ObjectStamp: Detect allways null cases in castTo. AlwaysNull stamps can keep their type information
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11384
diff changeset
215 }
366136516cc6 ObjectStamp: Detect allways null cases in castTo. AlwaysNull stamps can keep their type information
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11384
diff changeset
216 if (joinExactType || (!type.isInterface() && !other.type.isInterface())) {
366136516cc6 ObjectStamp: Detect allways null cases in castTo. AlwaysNull stamps can keep their type information
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11384
diff changeset
217 joinAlwaysNull = true;
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
218 }
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
219 }
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
220 }
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
221 if (joinAlwaysNull) {
11394
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
222 joinType = null;
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
223 joinExactType = false;
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
224 }
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
225 if (joinExactType && joinType == null) {
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
226 return StampFactory.illegal(Kind.Object);
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
227 }
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
228 if (joinAlwaysNull && joinNonNull) {
40c7cbe31aa9 Simplify ObjectStamp.join and make sure there is no type/exact type when going to an allways null stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11387
diff changeset
229 return StampFactory.illegal(Kind.Object);
13609
14db6fb488a0 UnsafeAllocTest: fix stamp problem
Bernhard Urban <bernhard.urban@jku.at>
parents: 11394
diff changeset
230 } else if (joinExactType && !isConcreteType(joinType)) {
11387
9088d13767f3 Keep a kind in the illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11386
diff changeset
231 return StampFactory.illegal(Kind.Object);
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
232 }
14158
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14003
diff changeset
233 if (Objects.equals(joinType, type) && joinExactType == exactType && joinNonNull == nonNull && joinAlwaysNull == alwaysNull) {
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
234 return this;
14158
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14003
diff changeset
235 } else if (Objects.equals(joinType, other.type) && joinExactType == other.exactType && joinNonNull == other.nonNull && joinAlwaysNull == other.alwaysNull) {
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
236 return other;
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
237 } else {
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
238 return copyWith(joinType, joinExactType, joinNonNull, joinAlwaysNull);
5890
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
239 }
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
240 }
c241963cda6d added Stamp.join, used by PiNodes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5831
diff changeset
241
13609
14db6fb488a0 UnsafeAllocTest: fix stamp problem
Bernhard Urban <bernhard.urban@jku.at>
parents: 11394
diff changeset
242 public static boolean isConcreteType(ResolvedJavaType type) {
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
243 return !(type.isAbstract() && !type.isArray());
13609
14db6fb488a0 UnsafeAllocTest: fix stamp problem
Bernhard Urban <bernhard.urban@jku.at>
parents: 11394
diff changeset
244 }
14db6fb488a0 UnsafeAllocTest: fix stamp problem
Bernhard Urban <bernhard.urban@jku.at>
parents: 11394
diff changeset
245
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: 5540
diff changeset
246 private static ResolvedJavaType meetTypes(ResolvedJavaType a, ResolvedJavaType b) {
14158
fd7fcd2d2072 replaced == with .equals() for comparisons between JavaMethod/JavaField/JavaType values
Doug Simon <doug.simon@oracle.com>
parents: 14003
diff changeset
247 if (Objects.equals(a, b)) {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
248 return a;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
249 } else if (a == null || b == null) {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
250 return null;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
251 } else {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5890
diff changeset
252 return a.findLeastCommonAncestor(b);
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
253 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
254 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
255
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
256 @Override
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
257 public int hashCode() {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
258 final int prime = 31;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
259 int result = 1;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
260 result = prime * result + (exactType ? 1231 : 1237);
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
261 result = prime * result + (nonNull ? 1231 : 1237);
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
262 result = prime * result + (alwaysNull ? 1231 : 1237);
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
263 result = prime * result + ((type == null) ? 0 : type.hashCode());
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
264 return result;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
265 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
266
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
267 @Override
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
268 public boolean equals(Object obj) {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
269 if (this == obj) {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
270 return true;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
271 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
272 if (obj == null || getClass() != obj.getClass()) {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
273 return false;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
274 }
16314
f57cf459f5d3 [SPARC] Adding deoptimization handler foreign call
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15198
diff changeset
275 AbstractObjectStamp other = (AbstractObjectStamp) obj;
11265
ef6915cf1e59 Add illegal stamp
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9786
diff changeset
276 if (exactType != other.exactType || nonNull != other.nonNull || alwaysNull != other.alwaysNull) {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
277 return false;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
278 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
279 if (type == null) {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
280 if (other.type != null) {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
281 return false;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
282 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
283 } else if (!type.equals(other.type)) {
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
284 return false;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
285 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
286 return true;
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
287 }
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff changeset
288 }