annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstant.java @ 21556:48c1ebd24120

renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Wed, 27 May 2015 00:36:16 +0200
parents 9579a3c62a9e
children f5b549811bac
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 */
21552
9579a3c62a9e use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 20973
diff changeset
23 package com.oracle.jvmci.hotspot;
15018
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.*;
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
26 import java.util.*;
18286
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
27
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
28 import com.oracle.jvmci.meta.*;
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
29
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
30
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
31 /**
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
32 * 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
33 * compiler/runtime interface.
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
34 */
18530
2906b3cc3e2f moved application of Remote marker interface to implementation classes only
Doug Simon <doug.simon@oracle.com>
parents: 18324
diff changeset
35 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
36
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18188
diff changeset
37 JavaConstant compress();
15909
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
38
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18188
diff changeset
39 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
40
18280
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
41 /**
18543
0ec7e37451c7 added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents: 18533
diff changeset
42 * 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
43 */
0ec7e37451c7 added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents: 18533
diff changeset
44 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
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 /**
18280
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
47 * 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
48 * this constant.
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
49 *
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
50 * @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
51 */
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
52 JavaConstant getClassLoader();
18282
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
53
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
54 /**
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
55 * 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
56 * represented by this constant.
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
57 */
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
58 int getIdentityHashCode();
18283
b2eb7302706c added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents: 18282
diff changeset
59
b2eb7302706c added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents: 18282
diff changeset
60 /**
18284
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
61 * 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
62 * by this constant.
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
63 *
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
64 * @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
65 */
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
66 JavaConstant getComponentType();
18285
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
67
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
68 /**
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
69 * 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
70 * this constant.
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
71 *
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
72 * @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
73 */
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
74 JavaConstant getSuperclass();
18286
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
75
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
76 /**
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
77 * 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
78 * by this constant.
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
79 *
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
80 * @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
81 * change
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
82 * @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
83 */
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
84 JavaConstant getCallSiteTarget(Assumptions assumptions);
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
85
18287
b7461f7fa8a0 added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents: 18286
diff changeset
86 /**
18288
feef9ed5fc56 added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents: 18287
diff changeset
87 * 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
88 */
feef9ed5fc56 added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents: 18287
diff changeset
89 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
90
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
91 /**
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 * 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
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 * @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
95 * 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
96 * {@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
97 * @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
98 * {@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
99 * {@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
100 */
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 <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
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 /**
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 * 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
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 * @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
107 * 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
108 * {@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
109 * @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
110 * {@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
111 * {@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
112 */
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 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
114 }