Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstantImpl.java @ 23677:eb166b568645
Merge
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 09 Jun 2016 18:58:09 -0700 |
parents | 1d4ce2d19e52 |
children |
rev | line source |
---|---|
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
1 /* |
22489
24b4e5e1431c
Remove JavaConstant from Value hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
22398
diff
changeset
|
2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
4 * |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
8 * |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
14 * |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
18 * |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22645
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
24 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22645
diff
changeset
|
25 import static jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.fromObjectClass; |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
26 |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
27 import java.lang.invoke.CallSite; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
28 import java.lang.invoke.ConstantCallSite; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22536
diff
changeset
|
29 import java.lang.invoke.MethodHandle; |
18543
0ec7e37451c7
added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents:
18533
diff
changeset
|
30 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22645
diff
changeset
|
31 import jdk.vm.ci.meta.Assumptions; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22645
diff
changeset
|
32 import jdk.vm.ci.meta.Constant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22645
diff
changeset
|
33 import jdk.vm.ci.meta.JavaConstant; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22645
diff
changeset
|
34 import jdk.vm.ci.meta.JavaKind; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22645
diff
changeset
|
35 import jdk.vm.ci.meta.ResolvedJavaType; |
18288
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
36 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
37 /** |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
38 * Represents a constant non-{@code null} object reference, within the compiler and across the |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
39 * compiler/runtime interface. |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
40 */ |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
23384
diff
changeset
|
41 final class HotSpotObjectConstantImpl implements HotSpotObjectConstant { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
42 |
22645
c33f0cb02b34
Add ConstantReflectionProvider.forObject method and make HotSpotObjectConstantImpl package-private.
Roland Schatz <roland.schatz@oracle.com>
parents:
22569
diff
changeset
|
43 static JavaConstant forObject(Object object) { |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18320
diff
changeset
|
44 return forObject(object, false); |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18320
diff
changeset
|
45 } |
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18320
diff
changeset
|
46 |
18543
0ec7e37451c7
added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents:
18533
diff
changeset
|
47 static JavaConstant forObject(Object object, boolean compressed) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
48 if (object == null) { |
18490
ca81508f2a19
Generalize NULL handling to work on arbitrary pointers.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
49 return compressed ? HotSpotCompressedNullConstant.COMPRESSED_NULL : JavaConstant.NULL_POINTER; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
50 } else { |
18359
a3a2359ac88e
Support constant folding of pointer reads.
Roland Schatz <roland.schatz@oracle.com>
parents:
18320
diff
changeset
|
51 return new HotSpotObjectConstantImpl(object, compressed); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
52 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
53 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
54 |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22489
diff
changeset
|
55 public static JavaConstant forBoxedValue(JavaKind kind, Object value) { |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22489
diff
changeset
|
56 if (kind == JavaKind.Object) { |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
57 return HotSpotObjectConstantImpl.forObject(value); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
58 } else { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
59 return JavaConstant.forBoxedPrimitive(value); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
60 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
61 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
62 |
18543
0ec7e37451c7
added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents:
18533
diff
changeset
|
63 static Object asBoxedValue(Constant constant) { |
18188
8652481a1110
Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
64 if (JavaConstant.isNull(constant)) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
65 return null; |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
66 } else if (constant instanceof HotSpotObjectConstantImpl) { |
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
67 return ((HotSpotObjectConstantImpl) constant).object; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
68 } else { |
18188
8652481a1110
Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
69 return ((JavaConstant) constant).asBoxedPrimitive(); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
70 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
71 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
72 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
73 private final Object object; |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
74 private final boolean compressed; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
75 |
23384
f102ee538647
Remove stable constant handling from ConstantReflectionProvider (JDK-8156552).
Roland Schatz <roland.schatz@oracle.com>
parents:
22672
diff
changeset
|
76 private HotSpotObjectConstantImpl(Object object, boolean compressed) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
77 this.object = object; |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
78 this.compressed = compressed; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
79 assert object != null; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
80 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
81 |
22489
24b4e5e1431c
Remove JavaConstant from Value hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
22398
diff
changeset
|
82 @Override |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22489
diff
changeset
|
83 public JavaKind getJavaKind() { |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22489
diff
changeset
|
84 return JavaKind.Object; |
22489
24b4e5e1431c
Remove JavaConstant from Value hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
22398
diff
changeset
|
85 } |
24b4e5e1431c
Remove JavaConstant from Value hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
22398
diff
changeset
|
86 |
18290
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
87 /** |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
88 * Package-private accessor for the object represented by this constant. |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
89 */ |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
90 Object object() { |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
91 return object; |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
92 } |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
93 |
18289
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18288
diff
changeset
|
94 public boolean isCompressed() { |
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18288
diff
changeset
|
95 return compressed; |
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18288
diff
changeset
|
96 } |
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18288
diff
changeset
|
97 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
98 public JavaConstant compress() { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
99 assert !compressed; |
23384
f102ee538647
Remove stable constant handling from ConstantReflectionProvider (JDK-8156552).
Roland Schatz <roland.schatz@oracle.com>
parents:
22672
diff
changeset
|
100 return new HotSpotObjectConstantImpl(object, true); |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
101 } |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
102 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
103 public JavaConstant uncompress() { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
104 assert compressed; |
23384
f102ee538647
Remove stable constant handling from ConstantReflectionProvider (JDK-8156552).
Roland Schatz <roland.schatz@oracle.com>
parents:
22672
diff
changeset
|
105 return new HotSpotObjectConstantImpl(object, false); |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
106 } |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
107 |
18543
0ec7e37451c7
added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents:
18533
diff
changeset
|
108 public HotSpotResolvedObjectType getType() { |
0ec7e37451c7
added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents:
18533
diff
changeset
|
109 return fromObjectClass(object.getClass()); |
0ec7e37451c7
added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents:
18533
diff
changeset
|
110 } |
0ec7e37451c7
added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents:
18533
diff
changeset
|
111 |
18280
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
112 public JavaConstant getClassLoader() { |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
113 if (object instanceof Class) { |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
114 /* |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
115 * This is an intrinsic for getClassLoader0, which occurs after any security checks. We |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
116 * can't call that directly so just call getClassLoader. |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
117 */ |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
118 return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getClassLoader()); |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
119 } |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
120 return null; |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
121 } |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
122 |
18282
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18280
diff
changeset
|
123 public int getIdentityHashCode() { |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18280
diff
changeset
|
124 return System.identityHashCode(object); |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18280
diff
changeset
|
125 } |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18280
diff
changeset
|
126 |
18284
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
127 public JavaConstant getComponentType() { |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
128 if (object instanceof Class) { |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
129 return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getComponentType()); |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
130 } |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
131 return null; |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
132 } |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
133 |
18285
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
134 public JavaConstant getSuperclass() { |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
135 if (object instanceof Class) { |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
136 return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getSuperclass()); |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
137 } |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
138 return null; |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
139 } |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
140 |
18286
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
141 public JavaConstant getCallSiteTarget(Assumptions assumptions) { |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
142 if (object instanceof CallSite) { |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
143 CallSite callSite = (CallSite) object; |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
144 MethodHandle target = callSite.getTarget(); |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
145 if (!(callSite instanceof ConstantCallSite)) { |
19306
a0a760b0fb5f
pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents:
18867
diff
changeset
|
146 if (assumptions == null) { |
18286
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
147 return null; |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
148 } |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
149 assumptions.record(new Assumptions.CallSiteTargetValue(callSite, target)); |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
150 } |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
151 return HotSpotObjectConstantImpl.forObject(target); |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
152 } |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
153 return null; |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
154 } |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
155 |
18288
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
156 @SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "reference equality is what we want") |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
157 public boolean isInternedString() { |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
158 if (object instanceof String) { |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
159 String s = (String) object; |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
160 return s.intern() == s; |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
161 } |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
162 return false; |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
163 } |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
164 |
18533
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
165 public <T> T asObject(Class<T> type) { |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
166 if (type.isInstance(object)) { |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
167 return type.cast(object); |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
168 } |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
169 return null; |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
170 } |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
171 |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
172 public Object asObject(ResolvedJavaType type) { |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
173 if (type.isInstance(this)) { |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
174 return object; |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
175 } |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
176 return null; |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
177 } |
25a21e1794ec
modified SnippetReflectionProvider to support both VM-side and compiler-side constants in a compilation replay context
Doug Simon <doug.simon@oracle.com>
parents:
18530
diff
changeset
|
178 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
179 @Override |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
180 public boolean isNull() { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
181 return false; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
182 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
183 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
184 @Override |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
185 public boolean isDefaultForKind() { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
186 return false; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
187 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
188 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
189 @Override |
18186
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
190 public Object asBoxedPrimitive() { |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
191 throw new IllegalArgumentException(); |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
192 } |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
193 |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
194 @Override |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
195 public int asInt() { |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
196 throw new IllegalArgumentException(); |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
197 } |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
198 |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
199 @Override |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
200 public boolean asBoolean() { |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
201 throw new IllegalArgumentException(); |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
202 } |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
203 |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
204 @Override |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
205 public long asLong() { |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
206 throw new IllegalArgumentException(); |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
207 } |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
208 |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
209 @Override |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
210 public float asFloat() { |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
211 throw new IllegalArgumentException(); |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
212 } |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
213 |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
214 @Override |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
215 public double asDouble() { |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
216 throw new IllegalArgumentException(); |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
217 } |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
218 |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
219 @Override |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
220 public int hashCode() { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
221 return System.identityHashCode(object); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
222 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
223 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
224 @Override |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
225 public boolean equals(Object o) { |
18471
7b60f8334af0
Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
226 if (o == this) { |
7b60f8334af0
Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
227 return true; |
7b60f8334af0
Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
228 } else if (o instanceof HotSpotObjectConstantImpl) { |
7b60f8334af0
Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
229 HotSpotObjectConstantImpl other = (HotSpotObjectConstantImpl) o; |
23384
f102ee538647
Remove stable constant handling from ConstantReflectionProvider (JDK-8156552).
Roland Schatz <roland.schatz@oracle.com>
parents:
22672
diff
changeset
|
230 return object == other.object && compressed == other.compressed; |
18471
7b60f8334af0
Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
231 } |
7b60f8334af0
Compare compressed flag in HotSpotObjectConstantImpl#equals and reference equality in HotSpotConstantReflectionProvider#constantEquals
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
232 return false; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
233 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
234 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
235 @Override |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
236 public String toValueString() { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
237 if (object instanceof String) { |
22093
eb025d2d7ce2
Distinguish "null" from null in toValueString
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22087
diff
changeset
|
238 return "\"" + (String) object + "\""; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
239 } else { |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22489
diff
changeset
|
240 return JavaKind.Object.format(object); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
241 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
242 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
243 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
244 @Override |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
245 public String toString() { |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22489
diff
changeset
|
246 return (compressed ? "NarrowOop" : getJavaKind().getJavaName()) + "[" + JavaKind.Object.format(object) + "]"; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
247 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
248 } |