public class HotSpotConstantReflectionProvider extends Object implements ConstantReflectionProvider, HotSpotProxified
ConstantReflectionProvider
.Modifier and Type | Class and Description |
---|---|
(package private) static class |
HotSpotConstantReflectionProvider.Options |
Modifier and Type | Field and Description |
---|---|
protected HotSpotMemoryAccessProviderImpl |
memoryAccess |
protected HotSpotMethodHandleAccessProvider |
methodHandleAccess |
protected HotSpotJVMCIRuntimeProvider |
runtime |
private static String |
SystemClassName |
Constructor and Description |
---|
HotSpotConstantReflectionProvider(HotSpotJVMCIRuntimeProvider runtime) |
protected final HotSpotJVMCIRuntimeProvider runtime
protected final HotSpotMethodHandleAccessProvider methodHandleAccess
protected final HotSpotMemoryAccessProviderImpl memoryAccess
private static final String SystemClassName
public HotSpotConstantReflectionProvider(HotSpotJVMCIRuntimeProvider runtime)
public MethodHandleAccessProvider getMethodHandleAccess()
getMethodHandleAccess
in interface ConstantReflectionProvider
public MemoryAccessProvider getMemoryAccessProvider()
getMemoryAccessProvider
in interface ConstantReflectionProvider
public Boolean constantEquals(Constant x, Constant y)
constantEquals
in interface ConstantReflectionProvider
public Integer readArrayLength(JavaConstant array)
readArrayLength
in interface ConstantReflectionProvider
public JavaConstant readConstantArrayElement(JavaConstant array, int index)
readConstantArrayElement
in interface ConstantReflectionProvider
private int indexForOffset(JavaConstant array, long offset)
offset
into an an index into array
.public JavaConstant readConstantArrayElementForOffset(JavaConstant array, long offset)
readConstantArrayElementForOffset
in interface ConstantReflectionProvider
public JavaConstant readArrayElement(JavaConstant array, int index)
readArrayElement
in interface ConstantReflectionProvider
private static boolean isBoxCached(JavaConstant source)
source
- public JavaConstant boxPrimitive(JavaConstant source)
boxPrimitive
in interface ConstantReflectionProvider
public JavaConstant unboxPrimitive(JavaConstant source)
unboxPrimitive
in interface ConstantReflectionProvider
public JavaConstant forString(String value)
forString
in interface ConstantReflectionProvider
public ResolvedJavaType asJavaType(Constant constant)
asJavaType
in interface ConstantReflectionProvider
protected boolean isStaticFieldConstant(HotSpotResolvedJavaField staticField)
readConstantFieldValue(JavaField, JavaConstant)
.protected boolean isFinalInstanceFieldValueConstant(JavaConstant value, Class<?> receiverClass)
final
instance field is considered constant. The
implementation in HotSpotConstantReflectionProvider
returns true if value
is
not the default value
for its kind or if
HotSpotConstantReflectionProvider.Options.TrustFinalDefaultFields
is true.value
- a value read from a final
instance fieldreceiverClass
- the class
of object from which the
value
was readprotected boolean isStableInstanceFieldValueConstant(JavaConstant value, Class<?> receiverClass)
Stable
instance field is considered constant. The
implementation in HotSpotConstantReflectionProvider
returns true if value
is
not the default value
for its kind.public JavaConstant readConstantFieldValue(JavaField field, JavaConstant receiver)
The value
field in OptionValue
is considered constant if the type of
receiver
is (assignable to) StableOptionValue
.
readConstantFieldValue
in interface ConstantReflectionProvider
public JavaConstant readFieldValue(JavaField field, JavaConstant receiver)
readFieldValue
in interface ConstantReflectionProvider
private JavaConstant readNonStableFieldValue(JavaField field, JavaConstant receiver)
public JavaConstant readStableFieldValue(JavaField field, JavaConstant receiver, boolean isDefaultStable)
readStableFieldValue
in interface ConstantReflectionProvider
private static int getArrayDimension(JavaType type)