15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24
25 package org.graalvm.compiler.nodes.type;
26
27 import org.graalvm.compiler.core.common.CompressEncoding;
28 import org.graalvm.compiler.core.common.LIRKind;
29 import org.graalvm.compiler.core.common.spi.LIRKindTool;
30 import org.graalvm.compiler.core.common.type.AbstractObjectStamp;
31 import org.graalvm.compiler.core.common.type.ObjectStamp;
32 import org.graalvm.compiler.core.common.type.Stamp;
33
34 import jdk.vm.ci.meta.Constant;
35 import jdk.vm.ci.meta.JavaConstant;
36 import jdk.vm.ci.meta.MemoryAccessProvider;
37 import jdk.vm.ci.meta.ResolvedJavaType;
38
39 public abstract class NarrowOopStamp extends AbstractObjectStamp {
40
41 private final CompressEncoding encoding;
42
43 protected NarrowOopStamp(ResolvedJavaType type, boolean exactType, boolean nonNull, boolean alwaysNull, CompressEncoding encoding) {
44 super(type, exactType, nonNull, alwaysNull);
45 this.encoding = encoding;
46 }
47
48 @Override
49 protected abstract AbstractObjectStamp copyWith(ResolvedJavaType type, boolean exactType, boolean nonNull, boolean alwaysNull);
50
51 public Stamp uncompressed() {
52 return new ObjectStamp(type(), isExactType(), nonNull(), alwaysNull());
53 }
54
55 public CompressEncoding getEncoding() {
89 final int prime = 31;
90 int result = super.hashCode();
91 result = prime * result + encoding.hashCode();
92 return result;
93 }
94
95 @Override
96 public boolean equals(Object obj) {
97 if (this == obj) {
98 return true;
99 }
100 if (obj == null || getClass() != obj.getClass()) {
101 return false;
102 }
103 NarrowOopStamp other = (NarrowOopStamp) obj;
104 if (!encoding.equals(other.encoding)) {
105 return false;
106 }
107 return super.equals(other);
108 }
109
110 @Override
111 public abstract JavaConstant asConstant();
112
113 @Override
114 public abstract boolean isCompatible(Constant other);
115 }
|
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24
25 package org.graalvm.compiler.nodes.type;
26
27 import org.graalvm.compiler.core.common.CompressEncoding;
28 import org.graalvm.compiler.core.common.LIRKind;
29 import org.graalvm.compiler.core.common.spi.LIRKindTool;
30 import org.graalvm.compiler.core.common.type.AbstractObjectStamp;
31 import org.graalvm.compiler.core.common.type.ObjectStamp;
32 import org.graalvm.compiler.core.common.type.Stamp;
33
34 import jdk.vm.ci.meta.Constant;
35 import jdk.vm.ci.meta.MemoryAccessProvider;
36 import jdk.vm.ci.meta.ResolvedJavaType;
37
38 public abstract class NarrowOopStamp extends AbstractObjectStamp {
39
40 private final CompressEncoding encoding;
41
42 protected NarrowOopStamp(ResolvedJavaType type, boolean exactType, boolean nonNull, boolean alwaysNull, CompressEncoding encoding) {
43 super(type, exactType, nonNull, alwaysNull);
44 this.encoding = encoding;
45 }
46
47 @Override
48 protected abstract AbstractObjectStamp copyWith(ResolvedJavaType type, boolean exactType, boolean nonNull, boolean alwaysNull);
49
50 public Stamp uncompressed() {
51 return new ObjectStamp(type(), isExactType(), nonNull(), alwaysNull());
52 }
53
54 public CompressEncoding getEncoding() {
88 final int prime = 31;
89 int result = super.hashCode();
90 result = prime * result + encoding.hashCode();
91 return result;
92 }
93
94 @Override
95 public boolean equals(Object obj) {
96 if (this == obj) {
97 return true;
98 }
99 if (obj == null || getClass() != obj.getClass()) {
100 return false;
101 }
102 NarrowOopStamp other = (NarrowOopStamp) obj;
103 if (!encoding.equals(other.encoding)) {
104 return false;
105 }
106 return super.equals(other);
107 }
108
109 @Override
110 public abstract boolean isCompatible(Constant other);
111 }
|