Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java @ 22757:f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sun, 20 Dec 2015 23:15:24 +0100 |
parents | 3e573d7d32a7 |
children | 87394b31a42e |
rev | line source |
---|---|
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
2 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22645
diff
changeset
|
23 package jdk.vm.ci.meta; |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@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:
22536
diff
changeset
|
25 import java.lang.invoke.MethodHandle; |
18465
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
26 |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 /** |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
28 * Reflection operations on values represented as {@linkplain JavaConstant constants}. All methods |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
29 * in this interface require the VM to access the actual object encapsulated in |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
30 * {@link JavaKind#Object object} constants. This access is not always possible, depending on kind |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
31 * of VM and the state that the VM is in. Therefore, all methods can return {@code null} at any |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
32 * time, to indicate that the result is not available at this point. The caller is responsible to |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
33 * check for {@code null} results and handle them properly, e.g., not perform an optimization. |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@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:
18487
diff
changeset
|
35 public interface ConstantReflectionProvider { |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 /** |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
38 * Compares two constants for equality. The equality relationship is symmetric. Returns |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
39 * {@link Boolean#TRUE true} if the two constants represent the same run time value, |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
40 * {@link Boolean#FALSE false} if they are different. Returns {@code null} if the constants |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
41 * cannot be compared at this point. |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 */ |
18188
8652481a1110
Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
43 Boolean constantEquals(Constant x, Constant y); |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 /** |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
46 * Returns the length of the array constant. Returns {@code null} if the constant is not an |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
47 * array, or if the array length is not available at this point. |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 */ |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
49 Integer readArrayLength(JavaConstant array); |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 |
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 /** |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
52 * Reads a value from the given array at the given index. Returns {@code null} if the constant |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
53 * is not an array, if the index is out of bounds, or if the value is not available at this |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
54 * point. |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
55 */ |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
56 JavaConstant readArrayElement(JavaConstant array, int index); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
57 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
58 /** |
18472
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
59 * Reads a value from the given array at the given index if it is a stable array. Returns |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
60 * {@code null} if the constant is not a stable array, if it is a default value, if the index is |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
61 * out of bounds, or if the value is not available at this point. |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
62 */ |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
63 JavaConstant readConstantArrayElement(JavaConstant array, int index); |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
64 |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
65 /** |
21459
f5c2bc68205e
support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18530
diff
changeset
|
66 * Reads a value from the given array at the given offset if it is a stable array. The offset |
21643
2081f8f294fe
Fixed some javadoc
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
67 * will be decoded relative to the platform addressing into an index into the array. Returns |
21459
f5c2bc68205e
support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18530
diff
changeset
|
68 * {@code null} if the constant is not a stable array, if it is a default value, if the offset |
f5c2bc68205e
support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18530
diff
changeset
|
69 * is out of bounds, or if the value is not available at this point. |
f5c2bc68205e
support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18530
diff
changeset
|
70 */ |
f5c2bc68205e
support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18530
diff
changeset
|
71 JavaConstant readConstantArrayElementForOffset(JavaConstant array, long offset); |
f5c2bc68205e
support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18530
diff
changeset
|
72 |
f5c2bc68205e
support later folding of constant array reads
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18530
diff
changeset
|
73 /** |
18465
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
74 * Gets the constant value of this field. Note that a {@code static final} field may not be |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
75 * considered constant if its declaring class is not yet initialized or if it is a well known |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
76 * field that can be updated via other means (e.g., {@link System#setOut(java.io.PrintStream)}). |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
77 * |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
78 * @param receiver object from which this field's value is to be read. This value is ignored if |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
79 * this field is static. |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
80 * @return the constant value of this field or {@code null} if this field is not considered |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
81 * constant by the runtime |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
82 */ |
22757
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
83 JavaConstant readConstantFieldValue(ResolvedJavaField field, JavaConstant receiver); |
18465
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
84 |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
85 /** |
18472
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
86 * Gets the current value of this field for a given object, if available. |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
87 * |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
88 * There is no guarantee that the same value will be returned by this method for a field unless |
22757
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
89 * the field is considered to be |
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
90 * {@linkplain #readConstantFieldValue(ResolvedJavaField, JavaConstant) constant} by the |
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
91 * runtime. |
18465
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
92 * |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
93 * @param receiver object from which this field's value is to be read. This value is ignored if |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
94 * this field is static. |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
95 * @return the value of this field or {@code null} if the value is not available (e.g., because |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
96 * the field holder is not yet initialized). |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
97 */ |
22757
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
98 JavaConstant readFieldValue(ResolvedJavaField field, JavaConstant receiver); |
18465
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
99 |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
100 /** |
18472
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
101 * Gets the current value of this field for a given object, if available. Like |
22757
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
102 * {@link #readFieldValue(ResolvedJavaField, JavaConstant)} but treats array fields as stable. |
18472
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
103 * |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
104 * There is no guarantee that the same value will be returned by this method for a field unless |
22757
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
105 * the field is considered to be |
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
106 * {@linkplain #readConstantFieldValue(ResolvedJavaField, JavaConstant) constant} by the |
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
107 * runtime. |
18472
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
108 * |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
109 * @param receiver object from which this field's value is to be read. This value is ignored if |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
110 * this field is static. |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
111 * @param isDefaultStable if {@code true}, default values are considered stable |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
112 * @return the value of this field or {@code null} if the value is not available (e.g., because |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
113 * the field holder is not yet initialized). |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
114 */ |
22757
f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
Doug Simon <doug.simon@oracle.com>
parents:
22673
diff
changeset
|
115 JavaConstant readStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefaultStable); |
18472
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
116 |
de179c27cad3
Add support for stable array constants
Andreas Woess <andreas.woess@jku.at>
parents:
18465
diff
changeset
|
117 /** |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
118 * Converts the given {@link JavaKind#isPrimitive() primitive} constant to a boxed |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
119 * {@link JavaKind#Object object} constant, according to the Java boxing rules. Returns |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
120 * {@code null} if the source is is not a primitive constant, or the boxed value is not |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
121 * available at this point. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
122 */ |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
123 JavaConstant boxPrimitive(JavaConstant source); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
124 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
125 /** |
22536
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
126 * Converts the given {@link JavaKind#Object object} constant to a |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
127 * {@link JavaKind#isPrimitive() primitive} constant, according to the Java unboxing rules. |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
128 * Returns {@code null} if the source is is not an object constant that can be unboxed, or the |
dc1aeef79e7e
Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22054
diff
changeset
|
129 * unboxed value is not available at this point. |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
130 */ |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
15023
diff
changeset
|
131 JavaConstant unboxPrimitive(JavaConstant source); |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
132 |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
133 /** |
18295
17bf458cf86e
reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents:
18267
diff
changeset
|
134 * Gets a string as a {@link JavaConstant}. |
17bf458cf86e
reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents:
18267
diff
changeset
|
135 */ |
17bf458cf86e
reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents:
18267
diff
changeset
|
136 JavaConstant forString(String value); |
17bf458cf86e
reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents:
18267
diff
changeset
|
137 |
17bf458cf86e
reduced use of HotSpotObjectConstantImpl.forObject
Doug Simon <doug.simon@oracle.com>
parents:
18267
diff
changeset
|
138 /** |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
139 * Returns the {@link ResolvedJavaType} for a {@link Class} object (or any other object regarded |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
140 * as a class by the VM) encapsulated in the given constant. Returns {@code null} if the |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
141 * constant does not encapsulate a class, or if the type is not available at this point. |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13488
diff
changeset
|
142 */ |
18487
0f4813e0b4a9
Use asConstant() instead of asJavaConstant() where possible.
Roland Schatz <roland.schatz@oracle.com>
parents:
18482
diff
changeset
|
143 ResolvedJavaType asJavaType(Constant constant); |
18465
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
144 |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
145 /** |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
146 * Gets access to the internals of {@link MethodHandle}. |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
147 */ |
f0a8b72315c1
Move ResolvedJavaField#read[Constant]Value and getMethodHandleAccess() to ConstantReflectionProvider
Andreas Woess <andreas.woess@jku.at>
parents:
18359
diff
changeset
|
148 MethodHandleAccessProvider getMethodHandleAccess(); |
18482
b8a622c3e99f
Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
149 |
b8a622c3e99f
Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
150 /** |
b8a622c3e99f
Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
151 * Gets raw memory access. |
b8a622c3e99f
Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
152 */ |
b8a622c3e99f
Move raw memory access operations to a separate interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
18472
diff
changeset
|
153 MemoryAccessProvider getMemoryAccessProvider(); |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
154 } |