annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java @ 21526:1da7aef31a08

created com.oracle.graal.hotspot.jvmci package and moved classes destined for future JVMCI module into it (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Tue, 19 May 2015 23:16:07 +0200
parents 7ea471ed17e4
children 93c50cefb9e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
1 /*
21401
7ea471ed17e4 Fix handling of null flags in MetaspacePointerStamp operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 18500
diff changeset
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
4 *
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
8 *
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
13 * accompanied this code).
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
14 *
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
18 *
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
21 * questions.
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
22 */
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.hotspot.nodes.type;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
24
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
25 import java.util.*;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
26
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
27 import com.oracle.graal.api.meta.*;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
28 import com.oracle.graal.compiler.common.spi.*;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
29 import com.oracle.graal.compiler.common.type.*;
21526
1da7aef31a08 created com.oracle.graal.hotspot.jvmci package and moved classes destined for future JVMCI module into it (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21401
diff changeset
30 import com.oracle.graal.hotspot.jvmci.*;
1da7aef31a08 created com.oracle.graal.hotspot.jvmci package and moved classes destined for future JVMCI module into it (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21401
diff changeset
31 import com.oracle.graal.hotspot.jvmci.HotSpotVMConfig.*;
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
32
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
33 public final class KlassPointerStamp extends MetaspacePointerStamp {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
34
18497
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
35 private static final KlassPointerStamp KLASS = new KlassPointerStamp(false, false);
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
36
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
37 private static final KlassPointerStamp KLASS_NON_NULL = new KlassPointerStamp(true, false);
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
38
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
39 private static final KlassPointerStamp KLASS_ALWAYS_NULL = new KlassPointerStamp(false, true);
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
40
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
41 private final CompressEncoding encoding;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
42
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
43 public static KlassPointerStamp klass() {
18497
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
44 return KLASS;
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
45 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
46
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
47 public static KlassPointerStamp klassNonNull() {
18497
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
48 return KLASS_NON_NULL;
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
49 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
50
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
51 private KlassPointerStamp(boolean nonNull, boolean alwaysNull) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
52 this(nonNull, alwaysNull, null);
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
53 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
54
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
55 private KlassPointerStamp(boolean nonNull, boolean alwaysNull, CompressEncoding encoding) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
56 super(nonNull, alwaysNull);
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
57 this.encoding = encoding;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
58 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
59
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
60 @Override
21401
7ea471ed17e4 Fix handling of null flags in MetaspacePointerStamp operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 18500
diff changeset
61 protected AbstractPointerStamp copyWith(boolean newNonNull, boolean newAlwaysNull) {
7ea471ed17e4 Fix handling of null flags in MetaspacePointerStamp operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 18500
diff changeset
62 return new KlassPointerStamp(newNonNull, newAlwaysNull, encoding);
7ea471ed17e4 Fix handling of null flags in MetaspacePointerStamp operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 18500
diff changeset
63 }
7ea471ed17e4 Fix handling of null flags in MetaspacePointerStamp operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 18500
diff changeset
64
7ea471ed17e4 Fix handling of null flags in MetaspacePointerStamp operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 18500
diff changeset
65 @Override
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
66 public boolean isCompatible(Stamp otherStamp) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
67 if (this == otherStamp) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
68 return true;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
69 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
70 if (otherStamp instanceof KlassPointerStamp) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
71 KlassPointerStamp other = (KlassPointerStamp) otherStamp;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
72 return Objects.equals(this.encoding, other.encoding);
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
73 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
74 return false;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
75 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
76
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
77 @Override
18490
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
78 public Stamp constant(Constant c, MetaAccessProvider meta) {
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
79 if (isCompressed()) {
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
80 if (HotSpotCompressedNullConstant.COMPRESSED_NULL.equals(c)) {
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
81 return new KlassPointerStamp(false, true, encoding);
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
82 }
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
83 } else {
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
84 if (JavaConstant.NULL_POINTER.equals(c)) {
18497
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
85 return KLASS_ALWAYS_NULL;
18490
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
86 }
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
87 }
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
88
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
89 assert c instanceof HotSpotMetaspaceConstant;
18497
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
90 if (nonNull()) {
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
91 return this;
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
92 }
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
93 if (isCompressed()) {
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
94 return new KlassPointerStamp(true, false, encoding);
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
95 } else {
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
96 return KLASS_NON_NULL;
27d65fe58fef Minor pointer stamp related fixes
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18490
diff changeset
97 }
18490
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
98 }
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
99
ca81508f2a19 Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents: 18483
diff changeset
100 @Override
18500
5c5afd2c6bb3 Add missing override in KlassPointerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents: 18497
diff changeset
101 public Constant asConstant() {
5c5afd2c6bb3 Add missing override in KlassPointerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents: 18497
diff changeset
102 if (alwaysNull() && isCompressed()) {
5c5afd2c6bb3 Add missing override in KlassPointerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents: 18497
diff changeset
103 return HotSpotCompressedNullConstant.COMPRESSED_NULL;
5c5afd2c6bb3 Add missing override in KlassPointerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents: 18497
diff changeset
104 } else {
5c5afd2c6bb3 Add missing override in KlassPointerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents: 18497
diff changeset
105 return super.asConstant();
5c5afd2c6bb3 Add missing override in KlassPointerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents: 18497
diff changeset
106 }
5c5afd2c6bb3 Add missing override in KlassPointerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents: 18497
diff changeset
107 }
5c5afd2c6bb3 Add missing override in KlassPointerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents: 18497
diff changeset
108
5c5afd2c6bb3 Add missing override in KlassPointerStamp.
Roland Schatz <roland.schatz@oracle.com>
parents: 18497
diff changeset
109 @Override
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
110 public LIRKind getLIRKind(LIRKindTool tool) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
111 if (isCompressed()) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
112 return LIRKind.value(Kind.Int);
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
113 } else {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
114 return super.getLIRKind(tool);
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
115 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
116 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
117
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
118 public boolean isCompressed() {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
119 return encoding != null;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
120 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
121
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
122 public CompressEncoding getEncoding() {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
123 return encoding;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
124 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
125
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
126 public KlassPointerStamp compressed(CompressEncoding newEncoding) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
127 assert !isCompressed();
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
128 return new KlassPointerStamp(nonNull(), alwaysNull(), newEncoding);
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
129 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
130
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
131 public KlassPointerStamp uncompressed() {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
132 assert isCompressed();
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
133 return new KlassPointerStamp(nonNull(), alwaysNull());
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
134 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
135
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
136 @Override
18482
b8a622c3e99f Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 18481
diff changeset
137 public Constant readConstant(MemoryAccessProvider provider, Constant base, long displacement) {
18483
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
138 HotSpotMemoryAccessProvider hsProvider = (HotSpotMemoryAccessProvider) provider;
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
139 if (isCompressed()) {
18483
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
140 return hsProvider.readNarrowKlassPointerConstant(base, displacement, encoding);
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
141 } else {
18483
d7cc487d1325 Move HotSpot specific functionality to new subinterface of ConstantReflectionProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18482
diff changeset
142 return hsProvider.readKlassPointerConstant(base, displacement);
18481
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
143 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
144 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
145
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
146 @Override
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
147 public int hashCode() {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
148 final int prime = 31;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
149 int result = super.hashCode();
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
150 result = prime * result + ((encoding == null) ? 0 : encoding.hashCode());
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
151 return result;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
152 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
153
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
154 @Override
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
155 public boolean equals(Object obj) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
156 if (this == obj) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
157 return true;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
158 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
159 if (!super.equals(obj)) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
160 return false;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
161 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
162 if (!(obj instanceof KlassPointerStamp)) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
163 return false;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
164 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
165 KlassPointerStamp other = (KlassPointerStamp) obj;
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
166 return Objects.equals(this.encoding, other.encoding);
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
167 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
168
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
169 @Override
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
170 public String toString() {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
171 StringBuilder ret = new StringBuilder("Klass*");
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
172 appendString(ret);
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
173 if (isCompressed()) {
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
174 ret.append("(compressed ").append(encoding).append(")");
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
175 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
176 return ret.toString();
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
177 }
f91e40c4bb47 Create separate stamps for Klass* and Method*, and make them hotspot specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
178 }