comparison graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstant.java @ 21551:5324104ac4f3

moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Tue, 26 May 2015 17:13:37 +0200
parents
children
comparison
equal deleted inserted replaced
21550:f48a6cea31eb 21551:5324104ac4f3
1 /*
2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.jvmci.hotspot;
24
25 import java.lang.invoke.*;
26 import java.util.*;
27
28 import com.oracle.graal.api.meta.*;
29
30 /**
31 * Represents a constant non-{@code null} object reference, within the compiler and across the
32 * compiler/runtime interface.
33 */
34 public interface HotSpotObjectConstant extends JavaConstant, HotSpotConstant, VMConstant {
35
36 JavaConstant compress();
37
38 JavaConstant uncompress();
39
40 /**
41 * Gets the resolved Java type of the object represented by this constant.
42 */
43 HotSpotResolvedObjectType getType();
44
45 /**
46 * Gets the result of {@link Class#getClassLoader()} for the {@link Class} object represented by
47 * this constant.
48 *
49 * @return {@code null} if this constant does not represent a {@link Class} object
50 */
51 JavaConstant getClassLoader();
52
53 /**
54 * Gets the {@linkplain System#identityHashCode(Object) identity} has code for the object
55 * represented by this constant.
56 */
57 int getIdentityHashCode();
58
59 /**
60 * Gets the result of {@link Class#getComponentType()} for the {@link Class} object represented
61 * by this constant.
62 *
63 * @return {@code null} if this constant does not represent a {@link Class} object
64 */
65 JavaConstant getComponentType();
66
67 /**
68 * Gets the result of {@link Class#getSuperclass()} for the {@link Class} object represented by
69 * this constant.
70 *
71 * @return {@code null} if this constant does not represent a {@link Class} object
72 */
73 JavaConstant getSuperclass();
74
75 /**
76 * Gets the result of {@link CallSite#getTarget()} for the {@link CallSite} object represented
77 * by this constant.
78 *
79 * @param assumptions used to register an assumption that the {@link CallSite}'s target does not
80 * change
81 * @return {@code null} if this constant does not represent a {@link CallSite} object
82 */
83 JavaConstant getCallSiteTarget(Assumptions assumptions);
84
85 /**
86 * Determines if this constant represents an {@linkplain String#intern() interned} string.
87 */
88 boolean isInternedString();
89
90 /**
91 * Gets the object represented by this constant represents if it is of a given type.
92 *
93 * @param type the expected type of the object represented by this constant. If the object is
94 * required to be of this type, then wrap the call to this method in
95 * {@link Objects#requireNonNull(Object)}.
96 * @return the object value represented by this constant if it is an
97 * {@link ResolvedJavaType#isInstance(JavaConstant) instance of} {@code type} otherwise
98 * {@code null}
99 */
100 <T> T asObject(Class<T> type);
101
102 /**
103 * Gets the object represented by this constant represents if it is of a given type.
104 *
105 * @param type the expected type of the object represented by this constant. If the object is
106 * required to be of this type, then wrap the call to this method in
107 * {@link Objects#requireNonNull(Object)}.
108 * @return the object value represented by this constant if it is an
109 * {@link ResolvedJavaType#isInstance(JavaConstant) instance of} {@code type} otherwise
110 * {@code null}
111 */
112 Object asObject(ResolvedJavaType type);
113 }