public class HotSpotSnippetReflectionProvider extends Object implements SnippetReflectionProvider
Modifier and Type | Field and Description |
---|---|
private ResolvedJavaType |
configType |
private HotSpotGraalRuntimeProvider |
runtime |
private ResolvedJavaType |
runtimeType |
private ResolvedJavaType |
wordTypesType |
Constructor and Description |
---|
HotSpotSnippetReflectionProvider(HotSpotGraalRuntimeProvider runtime) |
Modifier and Type | Method and Description |
---|---|
<T> T |
asObject(Class<T> type,
JavaConstant constant)
Gets the object reference a given constant represents if it is of a given type.
|
Object |
asObject(ResolvedJavaType type,
JavaConstant constant)
Gets the object reference a given constant represents if it is of a given type.
|
JavaConstant |
forBoxed(Kind kind,
Object value)
Creates a boxed constant for the given kind from an Object.
|
JavaConstant |
forObject(Object object)
Creates a boxed
object constant. |
Object |
getInjectedNodeIntrinsicParameter(ResolvedJavaType type)
Gets the value to bind to an injected parameter in a node intrinsic.
|
Object |
getSubstitutionGuardParameter(Class<?> type)
Gets the value to bind to a parameter in a
SubstitutionGuard constructor. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invoke, newArray, readConstantFieldValue, resolveClassForSnippet
private final HotSpotGraalRuntimeProvider runtime
private ResolvedJavaType wordTypesType
private ResolvedJavaType runtimeType
private ResolvedJavaType configType
public HotSpotSnippetReflectionProvider(HotSpotGraalRuntimeProvider runtime)
public JavaConstant forObject(Object object)
SnippetReflectionProvider
object
constant.forObject
in interface SnippetReflectionProvider
object
- the object value to boxobject
public Object asObject(ResolvedJavaType type, JavaConstant constant)
SnippetReflectionProvider
Kind.Object
.asObject
in interface SnippetReflectionProvider
type
- the expected type of the object represented by constant
. If the object is
required to be of this type, then wrap the call to this method in
Objects.requireNonNull(Object)
.constant
- an object constantconstant
if it is an
instance of
type
otherwise
null
public <T> T asObject(Class<T> type, JavaConstant constant)
SnippetReflectionProvider
Kind.Object
.asObject
in interface SnippetReflectionProvider
type
- the expected type of the object represented by constant
. If the object is
required to be of this type, then wrap the call to this method in
Objects.requireNonNull(Object)
.constant
- an object constantconstant
cast to type
if it is an
instance of
type
otherwise null
public JavaConstant forBoxed(Kind kind, Object value)
SnippetReflectionProvider
forBoxed
in interface SnippetReflectionProvider
kind
- the kind of the constant to createvalue
- the Java boxed value: a Byte
instance for Kind.Byte
, etc.value
public Object getSubstitutionGuardParameter(Class<?> type)
SnippetReflectionProvider
SubstitutionGuard
constructor.getSubstitutionGuardParameter
in interface SnippetReflectionProvider
type
- the type of a parameter in a SubstitutionGuard
constructorpublic Object getInjectedNodeIntrinsicParameter(ResolvedJavaType type)
SnippetReflectionProvider
getInjectedNodeIntrinsicParameter
in interface SnippetReflectionProvider
type
- the type of a parameter in a node intrinsic constructor