annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/jvmci/HotSpotObjectConstant.java @ 21542:543957c1c6a6

removed more dependencies from JVMCI classes to non-JVMCI classes (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Mon, 25 May 2015 22:30:44 +0200
parents 1da7aef31a08
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 /*
19864
51da1608115e Move isCompressed method to HotSpotConstant interface.
Roland Schatz <roland.schatz@oracle.com>
parents: 19795
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 */
21526
1da7aef31a08 created com.oracle.graal.hotspot.jvmci package and moved classes destined for future JVMCI module into it (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 20973
diff changeset
23 package com.oracle.graal.hotspot.jvmci;
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
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.*;
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
29
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 * 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
32 * compiler/runtime interface.
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff changeset
33 */
18530
2906b3cc3e2f moved application of Remote marker interface to implementation classes only
Doug Simon <doug.simon@oracle.com>
parents: 18324
diff changeset
34 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
35
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18188
diff changeset
36 JavaConstant compress();
15909
e43591136d9f Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents: 15018
diff changeset
37
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18188
diff changeset
38 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
39
18280
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
40 /**
18545
0ec7e37451c7 added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents: 18533
diff changeset
41 * 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
42 */
0ec7e37451c7 added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents: 18533
diff changeset
43 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
44
0ec7e37451c7 added HotSpotObjectConstant.getType() and restricted access to some static methods in HotSpotObjectConstantImpl
Doug Simon <doug.simon@oracle.com>
parents: 18533
diff changeset
45 /**
18280
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
46 * 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
47 * this constant.
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
48 *
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
49 * @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
50 */
c7e0405a35d8 added HotSpotObjectConstant.getClassLoader()
Doug Simon <doug.simon@oracle.com>
parents: 18267
diff changeset
51 JavaConstant getClassLoader();
18282
ecf3de366ecc added HotSpotObjectConstant.getIdentityHashCode()
Doug Simon <doug.simon@oracle.com>
parents: 18280
diff changeset
52
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 * 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
55 * represented by this constant.
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 int getIdentityHashCode();
18283
b2eb7302706c added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents: 18282
diff changeset
58
b2eb7302706c added HotSpotObjectConstant.getNodeClass()
Doug Simon <doug.simon@oracle.com>
parents: 18282
diff changeset
59 /**
18284
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
60 * 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
61 * by this constant.
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
62 *
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
63 * @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
64 */
29ba2a7cdfcb added HotSpotObjectConstant.getComponentType()
Doug Simon <doug.simon@oracle.com>
parents: 18283
diff changeset
65 JavaConstant getComponentType();
18285
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
66
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 * 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
69 * this constant.
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 * @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
72 */
420161aee840 added HotSpotObjectConstant.getSuperclass()
Doug Simon <doug.simon@oracle.com>
parents: 18284
diff changeset
73 JavaConstant getSuperclass();
18286
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
74
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 * 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
77 * by this constant.
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 * @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
80 * change
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
81 * @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
82 */
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
83 JavaConstant getCallSiteTarget(Assumptions assumptions);
ffcbc50063a3 added HotSpotObjectConstant.getCallSiteTarget()
Doug Simon <doug.simon@oracle.com>
parents: 18285
diff changeset
84
18287
b7461f7fa8a0 added HotSpotObjectConstant.getCompositeValueClass()
Doug Simon <doug.simon@oracle.com>
parents: 18286
diff changeset
85 /**
18288
feef9ed5fc56 added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents: 18287
diff changeset
86 * 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
87 */
feef9ed5fc56 added HotSpotObjectConstant.isInternedString()
Doug Simon <doug.simon@oracle.com>
parents: 18287
diff changeset
88 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
89
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 * 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
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 * @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
94 * 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
95 * {@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
96 * @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
97 * {@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
98 * {@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
99 */
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 <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
101
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 * 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
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 * @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
106 * 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
107 * {@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
108 * @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
109 * {@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
110 * {@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
111 */
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 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
113 }