annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstant.java @ 24125:0c5404418ec2

Backout getMarkName fix
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 11 Apr 2017 08:59:43 -0700
parents 1bbd4a7c274b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 /*
19871
51da1608115e Move isCompressed method to HotSpotConstant interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 19800
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: 22569
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
22569
ec96f33a101d updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents: 22054
diff changeset
25 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: 22054
diff changeset
26 import java.util.Objects;
18286
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
27
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
28 import jdk.vm.ci.meta.Assumptions;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
29 import jdk.vm.ci.meta.JavaConstant;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
30 import jdk.vm.ci.meta.ResolvedJavaType;
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22569
diff changeset
31 import jdk.vm.ci.meta.VMConstant;
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21552
diff changeset
32
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
33 /**
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
34 * 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
35 * compiler/runtime interface.
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
36 */
18530
2906b3cc3e2f moved application of Remote marker interface to implementation classes only
Doug Simon <doug.simon@oracle.com>
parents: 18324
diff changeset
37 public interface HotSpotObjectConstant extends JavaConstant, HotSpotConstant, VMConstant {
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
38
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18188
diff changeset
39 JavaConstant compress();
15909
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
40
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18188
diff changeset
41 JavaConstant uncompress();
18186
ef357effbda7 Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
42
18280
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
43 /**
18543
0ec7e37451c7 added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents: 18533
diff changeset
44 * Gets the resolved Java type of the object represented by this constant.
0ec7e37451c7 added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents: 18533
diff changeset
45 */
0ec7e37451c7 added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents: 18533
diff changeset
46 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
47
0ec7e37451c7 added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents: 18533
diff changeset
48 /**
18280
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
49 * Gets the result of {@link Class#getClassLoader()} for the {@link Class} object represented by
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
50 * this constant.
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
51 *
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
52 * @return {@code null} if this constant does not represent a {@link Class} object
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
53 */
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
54 JavaConstant getClassLoader();
18282
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
55
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
56 /**
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
57 * Gets the {@linkplain System#identityHashCode(Object) identity} has code for the object
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
58 * represented by this constant.
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
59 */
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
60 int getIdentityHashCode();
18283
b2eb7302706c added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents: 18282
diff changeset
61
b2eb7302706c added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents: 18282
diff changeset
62 /**
18284
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
63 * Gets the result of {@link Class#getComponentType()} for the {@link Class} object represented
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
64 * by this constant.
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
65 *
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
66 * @return {@code null} if this constant does not represent a {@link Class} object
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
67 */
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
68 JavaConstant getComponentType();
18285
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
69
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
70 /**
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
71 * Gets the result of {@link Class#getSuperclass()} for the {@link Class} object represented by
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
72 * this constant.
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
73 *
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
74 * @return {@code null} if this constant does not represent a {@link Class} object
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
75 */
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
76 JavaConstant getSuperclass();
18286
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
77
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
78 /**
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
79 * Gets the result of {@link CallSite#getTarget()} for the {@link CallSite} object represented
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
80 * by this constant.
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
81 *
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
82 * @param assumptions used to register an assumption that the {@link CallSite}'s target does not
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
83 * change
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
84 * @return {@code null} if this constant does not represent a {@link CallSite} object
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
85 */
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
86 JavaConstant getCallSiteTarget(Assumptions assumptions);
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
87
18287
b7461f7fa8a0 added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents: 18286
diff changeset
88 /**
18288
feef9ed5fc56 added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents: 18287
diff changeset
89 * Determines if this constant represents an {@linkplain String#intern() interned} string.
feef9ed5fc56 added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents: 18287
diff changeset
90 */
feef9ed5fc56 added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents: 18287
diff changeset
91 boolean isInternedString();
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
92
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
93 /**
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
94 * Gets the object represented by this constant represents if it is of a given 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
95 *
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
96 * @param type the expected type of the object represented by this constant. If the object is
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
97 * required to be of this type, then wrap the call to this method in
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
98 * {@link Objects#requireNonNull(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
99 * @return the object value represented by this constant if it is an
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
100 * {@link ResolvedJavaType#isInstance(JavaConstant) instance of} {@code type} otherwise
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
101 * {@code 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
102 */
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
103 <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
104
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
105 /**
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
106 * Gets the object represented by this constant represents if it is of a given 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
107 *
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
108 * @param type the expected type of the object represented by this constant. If the object is
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
109 * required to be of this type, then wrap the call to this method in
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
110 * {@link Objects#requireNonNull(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
111 * @return the object value represented by this constant if it is an
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
112 * {@link ResolvedJavaType#isInstance(JavaConstant) instance of} {@code type} otherwise
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
113 * {@code 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
114 */
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
115 Object asObject(ResolvedJavaType type);
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
116 }