Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantReflectionProvider.java @ 23306:7b09dede4552
JVMCI options should not use System.getProperty() directly (JDK-8146820)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 08 Feb 2016 10:05:21 +0100 |
parents | 87394b31a42e |
children | f895a46e0a45 |
comparison
equal
deleted
inserted
replaced
23305:b057a49aa52a | 23306:7b09dede4552 |
---|---|
26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale; | 26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale; |
27 | 27 |
28 import java.lang.reflect.Array; | 28 import java.lang.reflect.Array; |
29 | 29 |
30 import jdk.vm.ci.common.JVMCIError; | 30 import jdk.vm.ci.common.JVMCIError; |
31 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option; | |
31 import jdk.vm.ci.meta.Constant; | 32 import jdk.vm.ci.meta.Constant; |
32 import jdk.vm.ci.meta.ConstantReflectionProvider; | 33 import jdk.vm.ci.meta.ConstantReflectionProvider; |
33 import jdk.vm.ci.meta.JavaConstant; | 34 import jdk.vm.ci.meta.JavaConstant; |
34 import jdk.vm.ci.meta.JavaKind; | 35 import jdk.vm.ci.meta.JavaKind; |
35 import jdk.vm.ci.meta.JavaType; | 36 import jdk.vm.ci.meta.JavaType; |
40 | 41 |
41 /** | 42 /** |
42 * HotSpot implementation of {@link ConstantReflectionProvider}. | 43 * HotSpot implementation of {@link ConstantReflectionProvider}. |
43 */ | 44 */ |
44 public class HotSpotConstantReflectionProvider implements ConstantReflectionProvider, HotSpotProxified { | 45 public class HotSpotConstantReflectionProvider implements ConstantReflectionProvider, HotSpotProxified { |
45 | |
46 private static final String TrustFinalDefaultFieldsProperty = "jvmci.TrustFinalDefaultFields"; | |
47 | |
48 /** | |
49 * Determines whether to treat {@code final} fields with default values as constant. | |
50 */ | |
51 private static final boolean TrustFinalDefaultFields = HotSpotJVMCIRuntime.getBooleanOption(TrustFinalDefaultFieldsProperty, true); | |
52 | 46 |
53 protected final HotSpotJVMCIRuntimeProvider runtime; | 47 protected final HotSpotJVMCIRuntimeProvider runtime; |
54 protected final HotSpotMethodHandleAccessProvider methodHandleAccess; | 48 protected final HotSpotMethodHandleAccessProvider methodHandleAccess; |
55 protected final HotSpotMemoryAccessProviderImpl memoryAccess; | 49 protected final HotSpotMemoryAccessProviderImpl memoryAccess; |
56 | 50 |
250 | 244 |
251 /** | 245 /** |
252 * Determines if a value read from a {@code final} instance field is considered constant. The | 246 * Determines if a value read from a {@code final} instance field is considered constant. The |
253 * implementation in {@link HotSpotConstantReflectionProvider} returns true if {@code value} is | 247 * implementation in {@link HotSpotConstantReflectionProvider} returns true if {@code value} is |
254 * not the {@link JavaConstant#isDefaultForKind default value} for its kind or if | 248 * not the {@link JavaConstant#isDefaultForKind default value} for its kind or if |
255 * {@link #TrustFinalDefaultFields} is true. | 249 * {@link Option#TrustFinalDefaultFields} is true. |
256 * | 250 * |
257 * @param value a value read from a {@code final} instance field | 251 * @param value a value read from a {@code final} instance field |
258 * @param receiverClass the {@link Object#getClass() class} of object from which the | 252 * @param receiverClass the {@link Object#getClass() class} of object from which the |
259 * {@code value} was read | 253 * {@code value} was read |
260 */ | 254 */ |
261 protected boolean isFinalInstanceFieldValueConstant(JavaConstant value, Class<?> receiverClass) { | 255 protected boolean isFinalInstanceFieldValueConstant(JavaConstant value, Class<?> receiverClass) { |
262 return !value.isDefaultForKind() || TrustFinalDefaultFields; | 256 return !value.isDefaultForKind() || Option.TrustFinalDefaultFields.getBoolean(); |
263 } | 257 } |
264 | 258 |
265 /** | 259 /** |
266 * Determines if a value read from a {@link Stable} instance field is considered constant. The | 260 * Determines if a value read from a {@link Stable} instance field is considered constant. The |
267 * implementation in {@link HotSpotConstantReflectionProvider} returns true if {@code value} is | 261 * implementation in {@link HotSpotConstantReflectionProvider} returns true if {@code value} is |