Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java @ 18290:e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 06 Nov 2014 20:13:08 +0100 |
parents | 7acff34abbf7 |
children | ab8fbaa5e72f |
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 /* |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
2 * Copyright (c) 2009, 2014, 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 */ |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.meta; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
24 |
18286
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
25 import java.lang.invoke.*; |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
26 |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
27 import com.oracle.graal.api.code.*; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
28 import com.oracle.graal.api.meta.*; |
18283
b2eb7302706c
added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
18282
diff
changeset
|
29 import com.oracle.graal.graph.*; |
18287
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
30 import com.oracle.graal.lir.*; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
31 |
18288
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
32 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
33 |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
34 /** |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
35 * 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
|
36 * compiler/runtime interface. |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
37 */ |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
38 public final class HotSpotObjectConstantImpl extends JavaConstant implements HotSpotObjectConstant { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
39 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
40 private static final long serialVersionUID = 3592151693708093496L; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
41 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
42 public static JavaConstant forObject(Object object) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
43 if (object == null) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
44 return JavaConstant.NULL_OBJECT; |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
45 } else { |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
46 return new HotSpotObjectConstantImpl(object, false); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
47 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
48 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
49 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
50 public static JavaConstant forBoxedValue(Kind kind, Object value) { |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
51 if (kind == Kind.Object) { |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
52 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
|
53 } else { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
54 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
|
55 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
56 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
57 |
18188
8652481a1110
Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
58 public static Object asBoxedValue(Constant constant) { |
8652481a1110
Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
59 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
|
60 return null; |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
61 } else if (constant instanceof HotSpotObjectConstantImpl) { |
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
62 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
|
63 } else { |
18188
8652481a1110
Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
64 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
|
65 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
66 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
67 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
68 private final Object object; |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
69 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
|
70 |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
71 private HotSpotObjectConstantImpl(Object object, boolean compressed) { |
16116
9e5a323e0a1e
Remove hotspot specific NarrowOop kind, use LIRKind.reference(Kind.Int) instead.
Roland Schatz <roland.schatz@oracle.com>
parents:
16104
diff
changeset
|
72 super(LIRKind.reference(compressed ? Kind.Int : Kind.Object)); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
73 this.object = object; |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
74 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
|
75 assert object != null; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
76 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
77 |
18290
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
78 /** |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
79 * Package-private accessor for the object represented by this constant. |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
80 */ |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
81 Object object() { |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
82 return object; |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
83 } |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
84 |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
85 /** |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
86 * Determines if the object represented by this constant is {@link Object#equals(Object) equal} |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
87 * to a given object. |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
88 */ |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
89 public boolean isEqualTo(Object obj) { |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
90 return object.equals(obj); |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
91 } |
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 /** |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
94 * Gets the class of the object represented by this constant. |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
95 */ |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
96 public Class<?> getObjectClass() { |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
97 return object.getClass(); |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
98 } |
e7d219e9d01f
removed HotSpotObjectConstantImpl.asObject()
Doug Simon <doug.simon@oracle.com>
parents:
18289
diff
changeset
|
99 |
18289
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18288
diff
changeset
|
100 public boolean isCompressed() { |
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18288
diff
changeset
|
101 return compressed; |
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18288
diff
changeset
|
102 } |
7acff34abbf7
replaced HotSpotObjectConstantImpl.isCompressed() with HotSpotObjectConstant.isCompressed()
Doug Simon <doug.simon@oracle.com>
parents:
18288
diff
changeset
|
103 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
104 public JavaConstant compress() { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
105 assert !compressed; |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
106 return new HotSpotObjectConstantImpl(object, true); |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
107 } |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
108 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
109 public JavaConstant uncompress() { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
110 assert compressed; |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
111 return new HotSpotObjectConstantImpl(object, false); |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
112 } |
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
113 |
18280
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
114 public JavaConstant getClassLoader() { |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
115 if (object instanceof Class) { |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
116 /* |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
117 * 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
|
118 * can't call that directly so just call 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 HotSpotObjectConstantImpl.forObject(((Class<?>) object).getClassLoader()); |
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 return null; |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
123 } |
c7e0405a35d8
added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents:
18262
diff
changeset
|
124 |
18282
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18280
diff
changeset
|
125 public int getIdentityHashCode() { |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18280
diff
changeset
|
126 return System.identityHashCode(object); |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18280
diff
changeset
|
127 } |
ecf3de366ecc
added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents:
18280
diff
changeset
|
128 |
18283
b2eb7302706c
added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
18282
diff
changeset
|
129 public JavaConstant getNodeClass() { |
b2eb7302706c
added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
18282
diff
changeset
|
130 if (object instanceof Class) { |
b2eb7302706c
added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
18282
diff
changeset
|
131 return HotSpotObjectConstantImpl.forObject(NodeClass.get((Class<?>) object)); |
b2eb7302706c
added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
18282
diff
changeset
|
132 } |
b2eb7302706c
added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
18282
diff
changeset
|
133 return null; |
b2eb7302706c
added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
18282
diff
changeset
|
134 } |
b2eb7302706c
added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents:
18282
diff
changeset
|
135 |
18284
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
136 public JavaConstant getComponentType() { |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
137 if (object instanceof Class) { |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
138 return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getComponentType()); |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
139 } |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
140 return null; |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
141 } |
29ba2a7cdfcb
added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents:
18283
diff
changeset
|
142 |
18285
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
143 public JavaConstant getSuperclass() { |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
144 if (object instanceof Class) { |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
145 return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getSuperclass()); |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
146 } |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
147 return null; |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
148 } |
420161aee840
added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents:
18284
diff
changeset
|
149 |
18286
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
150 public JavaConstant getCallSiteTarget(Assumptions assumptions) { |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
151 if (object instanceof CallSite) { |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
152 CallSite callSite = (CallSite) object; |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
153 MethodHandle target = callSite.getTarget(); |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
154 if (!(callSite instanceof ConstantCallSite)) { |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
155 if (assumptions == null || !assumptions.useOptimisticAssumptions()) { |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
156 return null; |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
157 } |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
158 assumptions.record(new Assumptions.CallSiteTargetValue(callSite, target)); |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
159 } |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
160 return HotSpotObjectConstantImpl.forObject(target); |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
161 } |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
162 return null; |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
163 } |
ffcbc50063a3
added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents:
18285
diff
changeset
|
164 |
18287
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
165 @SuppressWarnings("unchecked") |
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
166 public JavaConstant getCompositeValueClass() { |
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
167 if (object instanceof Class) { |
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
168 Class<? extends CompositeValue> c = (Class<? extends CompositeValue>) object; |
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
169 assert CompositeValueClass.class.isAssignableFrom(c); |
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
170 return HotSpotObjectConstantImpl.forObject(CompositeValueClass.get(c)); |
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
171 } |
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
172 return null; |
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
173 } |
b7461f7fa8a0
added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents:
18286
diff
changeset
|
174 |
18288
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
175 @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
|
176 public boolean isInternedString() { |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
177 if (object instanceof String) { |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
178 String s = (String) object; |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
179 return s.intern() == s; |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
180 } |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
181 return false; |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
182 } |
feef9ed5fc56
added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents:
18287
diff
changeset
|
183 |
15018
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 isNull() { |
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 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
190 public boolean isDefaultForKind() { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
191 return false; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
192 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
193 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
194 @Override |
18186
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
195 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
|
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 int asInt() { |
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 boolean asBoolean() { |
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 long asLong() { |
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 float asFloat() { |
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 |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
220 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
|
221 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
|
222 } |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
223 |
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
224 @Override |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
225 public int hashCode() { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
226 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
|
227 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
228 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
229 @Override |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
230 public boolean equals(Object o) { |
18262
f7d45e2426d4
converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
231 return o == this || (o instanceof HotSpotObjectConstantImpl && super.equals(o) && object == ((HotSpotObjectConstantImpl) o).object); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
232 } |
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 @Override |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
235 public String toValueString() { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
236 if (object instanceof String) { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
237 return (String) object; |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
238 } else { |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
239 return Kind.Object.format(object); |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
240 } |
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 @Override |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
244 public String toString() { |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
245 return (compressed ? "NarrowOop" : getKind().getJavaName()) + "[" + Kind.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
|
246 } |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
247 } |