public final class ConstantNode extends FloatingNode implements LIRLowerable, ArrayLengthProvider
ConstantNode
represents a constant
.Node.ConstantNodeParameter, Node.EdgeVisitor, Node.IndirectCanonicalization, Node.InjectedNodeParameter, Node.Input, Node.NodeInsertionStackTrace, Node.NodeIntrinsic, Node.NodeIntrinsicFactory, Node.OptionalInput, Node.Successor, Node.ValueNumberable
ArrayLengthProvider.FindLengthMode
Modifier and Type | Field and Description |
---|---|
static NodeClass<ConstantNode> |
TYPE |
protected Constant |
value |
EMPTY_ARRAY, stamp
NODE_LIST, NOT_ITERABLE, TRACK_CREATION_POSITION, WithAllEdges, WithNoEdges, WithOnlyInputEdges, WithOnlySucessorEdges
Constructor and Description |
---|
ConstantNode(Constant value,
Stamp stamp)
Constructs a new node representing the specified constant.
|
ConstantNode(Stamp stamp,
ConstantReflectionProvider constantReflection,
ResolvedJavaType type) |
Modifier and Type | Method and Description |
---|---|
static ConstantNode |
defaultForKind(JavaKind kind) |
static ConstantNode |
defaultForKind(JavaKind kind,
StructuredGraph graph) |
ValueNode |
findLength(ArrayLengthProvider.FindLengthMode mode,
ConstantReflectionProvider constantReflection)
Returns the length of the array described by this node, or null if it is not available.
|
static ConstantNode |
forBoolean(boolean i)
Returns a node for a boolean constant.
|
static ConstantNode |
forBoolean(boolean i,
StructuredGraph graph)
Returns a node for a boolean constant.
|
static ConstantNode |
forByte(byte i,
StructuredGraph graph)
Returns a node for a byte constant.
|
static ConstantNode |
forChar(char i,
StructuredGraph graph)
Returns a node for a char constant.
|
static Class<?> |
forClass(ResolvedJavaType type) |
static ConstantNode |
forConstant(JavaConstant constant,
int stableDimension,
boolean isDefaultStable,
MetaAccessProvider metaAccess) |
static ConstantNode |
forConstant(JavaConstant array,
MetaAccessProvider metaAccess) |
static ConstantNode |
forConstant(JavaConstant constant,
MetaAccessProvider metaAccess,
StructuredGraph graph) |
static ConstantNode |
forConstant(Stamp stamp,
Constant constant,
int stableDimension,
boolean isDefaultStable,
MetaAccessProvider metaAccess) |
static ConstantNode |
forConstant(Stamp stamp,
Constant constant,
MetaAccessProvider metaAccess) |
static ConstantNode |
forConstant(Stamp stamp,
Constant constant,
MetaAccessProvider metaAccess,
StructuredGraph graph) |
static ConstantNode |
forDouble(double d)
Returns a node for a double constant.
|
static ConstantNode |
forDouble(double d,
StructuredGraph graph)
Returns a node for a double constant.
|
static ConstantNode |
forFloat(float f)
Returns a node for a float constant.
|
static ConstantNode |
forFloat(float f,
StructuredGraph graph)
Returns a node for a float constant.
|
static ConstantNode |
forFloatingKind(JavaKind kind,
double value) |
static ConstantNode |
forFloatingKind(JavaKind kind,
double value,
StructuredGraph graph) |
static ConstantNode |
forFloatingStamp(Stamp stamp,
double value)
Returns a node for a constant double that's compatible to a given stamp.
|
static ConstantNode |
forFloatingStamp(Stamp stamp,
double value,
StructuredGraph graph)
Returns a node for a constant double that's compatible to a given stamp.
|
static ConstantNode |
forInt(int i)
Returns a node for an integer constant.
|
static ConstantNode |
forInt(int i,
StructuredGraph graph)
Returns a node for an integer constant.
|
static ConstantNode |
forIntegerKind(JavaKind kind,
long value) |
static ConstantNode |
forIntegerKind(JavaKind kind,
long value,
StructuredGraph graph) |
static ConstantNode |
forIntegerStamp(Stamp stamp,
long value)
Returns a node for a constant integer that's compatible to a given stamp.
|
static ConstantNode |
forIntegerStamp(Stamp stamp,
long value,
StructuredGraph graph)
Returns a node for a constant integer that's compatible to a given stamp.
|
static ConstantNode |
forLong(long i)
Returns a node for an long constant.
|
static ConstantNode |
forLong(long i,
StructuredGraph graph)
Returns a node for an long constant.
|
static ConstantNode |
forPrimitive(JavaConstant constant)
Returns a node for a Java primitive.
|
static ConstantNode |
forPrimitive(JavaConstant constant,
StructuredGraph graph)
Returns a node for a Java primitive.
|
static ConstantNode |
forPrimitive(Stamp stamp,
Constant constant)
Returns a node for a primitive of a given type.
|
static ConstantNode |
forPrimitive(Stamp stamp,
JavaConstant constant,
StructuredGraph graph)
Returns a node for a primitive of a given type.
|
static ConstantNode |
forShort(short i,
StructuredGraph graph)
Returns a node for a short constant.
|
void |
generate(NodeLIRBuilderTool gen) |
static NodeIterable<ConstantNode> |
getConstantNodes(StructuredGraph graph)
Gathers all the
ConstantNode s that are inputs to the
live nodes in a given graph. |
Map<Object,Object> |
getDebugProperties(Map<Object,Object> map)
Fills a
Map with properties of this for use in debugging (e.g., to view in
the ideal graph visualizer). |
int |
getStableDimension() |
Constant |
getValue() |
boolean |
isDefaultStable() |
void |
replace(StructuredGraph graph,
Node replacement)
Replaces this node at its usages with another node.
|
String |
toString(Verbosity verbosity)
Creates a String representation for
this with a given Verbosity . |
asConstant, asJavaConstant, asNode, asSerializableConstant, checkReplaceAtUsagesInvariants, getStackKind, graph, hasUsagesOtherThan, inferStamp, isAllowedUsageType, isConstant, isConstantPredicate, isDefaultConstant, isIllegalConstant, isJavaConstant, isNullConstant, isSerializableConstant, recursivelyDataFlowEqualsUpTo, setStamp, stamp, updateStamp, updateUsagesInterface
afterClone, applyInputs, applySuccessors, assertFalse, assertTrue, cfgPredecessors, cfgSuccessors, clearInputs, clearNodeSourcePosition, clearSuccessors, copyWithInputs, copyWithInputs, dataFlowEquals, dynamicNodeSizeEstimate, estimatedNodeCycles, estimatedNodeSize, fail, formatTo, getCreationPosition, getDebug, getDebugProperties, getInsertionPosition, getNodeClass, getNodeSourcePosition, getOptions, getUsageCount, hasExactlyOneUsage, hasExactlyOneUsageOfType, hashCode, hasMoreThanOneUsage, hasNoUsages, hasOnlyUsagesOfType, hasUsages, hasUsagesOfType, inputPositions, inputs, isAlive, isDeleted, isUnregistered, markDeleted, maybeNotifyZeroUsages, modCount, predecessor, pushInputs, removeUsage, replaceAllInputs, replaceAndDelete, replaceAtAllUsages, replaceAtMatchingUsages, replaceAtPredecessor, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceAtUsages, replaceAtUsagesAndDelete, replaceAtUsagesAndDelete, replaceFirstInput, replaceFirstSuccessor, safeDelete, setCreationPosition, setInsertionPosition, setNodeSourcePosition, singleUsage, successorPositions, successors, toString, updateNodeSourcePosition, updatePredecessor, updateUsages, usages, valueEquals, verify, verifyEdges, verifyInputs, verifySourcePosition, withNodeSourcePosition
public static final NodeClass<ConstantNode> TYPE
protected final Constant value
public ConstantNode(Constant value, Stamp stamp)
value
- the constantpublic ConstantNode(Stamp stamp, ConstantReflectionProvider constantReflection, ResolvedJavaType type)
public Constant getValue()
public int getStableDimension()
public boolean isDefaultStable()
public static NodeIterable<ConstantNode> getConstantNodes(StructuredGraph graph)
ConstantNode
s that are inputs to the
live nodes in a given graph.public void replace(StructuredGraph graph, Node replacement)
public void generate(NodeLIRBuilderTool gen)
generate
in interface LIRLowerable
public static ConstantNode forConstant(JavaConstant constant, MetaAccessProvider metaAccess, StructuredGraph graph)
public static ConstantNode forConstant(JavaConstant constant, int stableDimension, boolean isDefaultStable, MetaAccessProvider metaAccess)
public static ConstantNode forConstant(JavaConstant array, MetaAccessProvider metaAccess)
public static ConstantNode forConstant(Stamp stamp, Constant constant, MetaAccessProvider metaAccess, StructuredGraph graph)
public static ConstantNode forConstant(Stamp stamp, Constant constant, int stableDimension, boolean isDefaultStable, MetaAccessProvider metaAccess)
public static ConstantNode forConstant(Stamp stamp, Constant constant, MetaAccessProvider metaAccess)
public static ConstantNode forPrimitive(JavaConstant constant, StructuredGraph graph)
public static ConstantNode forPrimitive(JavaConstant constant)
public static ConstantNode forPrimitive(Stamp stamp, JavaConstant constant, StructuredGraph graph)
public static ConstantNode forPrimitive(Stamp stamp, Constant constant)
public static ConstantNode forDouble(double d, StructuredGraph graph)
d
- the double value for which to create the instructionpublic static ConstantNode forDouble(double d)
d
- the double value for which to create the instructionpublic static ConstantNode forFloat(float f, StructuredGraph graph)
f
- the float value for which to create the instructionpublic static ConstantNode forFloat(float f)
f
- the float value for which to create the instructionpublic static ConstantNode forLong(long i, StructuredGraph graph)
i
- the long value for which to create the instructionpublic static ConstantNode forLong(long i)
i
- the long value for which to create the instructionpublic static ConstantNode forInt(int i, StructuredGraph graph)
i
- the integer value for which to create the instructionpublic static ConstantNode forInt(int i)
i
- the integer value for which to create the instructionpublic static ConstantNode forBoolean(boolean i, StructuredGraph graph)
i
- the boolean value for which to create the instructionpublic static ConstantNode forBoolean(boolean i)
i
- the boolean value for which to create the instructionpublic static ConstantNode forByte(byte i, StructuredGraph graph)
i
- the byte value for which to create the instructionpublic static ConstantNode forChar(char i, StructuredGraph graph)
i
- the char value for which to create the instructionpublic static ConstantNode forShort(short i, StructuredGraph graph)
i
- the short value for which to create the instructionpublic static ConstantNode forIntegerStamp(Stamp stamp, long value, StructuredGraph graph)
public static ConstantNode forIntegerStamp(Stamp stamp, long value)
public static ConstantNode forIntegerKind(JavaKind kind, long value, StructuredGraph graph)
public static ConstantNode forIntegerKind(JavaKind kind, long value)
public static ConstantNode forFloatingKind(JavaKind kind, double value, StructuredGraph graph)
public static ConstantNode forFloatingKind(JavaKind kind, double value)
public static ConstantNode forFloatingStamp(Stamp stamp, double value, StructuredGraph graph)
public static ConstantNode forFloatingStamp(Stamp stamp, double value)
public static ConstantNode defaultForKind(JavaKind kind, StructuredGraph graph)
public static ConstantNode defaultForKind(JavaKind kind)
public Map<Object,Object> getDebugProperties(Map<Object,Object> map)
Node
Map
with properties of this
for use in debugging (e.g., to view in
the ideal graph visualizer). Subclasses overriding this method should also fill the map using
their superclass.getDebugProperties
in class Node
public String toString(Verbosity verbosity)
Node
this
with a given Verbosity
.public ValueNode findLength(ArrayLengthProvider.FindLengthMode mode, ConstantReflectionProvider constantReflection)
ArrayLengthProvider
ArrayLengthProvider.FindLengthMode
.
This method should not be called directly. Use GraphUtil.arrayLength(org.graalvm.compiler.nodes.ValueNode, org.graalvm.compiler.nodes.spi.ArrayLengthProvider.FindLengthMode, ConstantReflectionProvider)
instead.findLength
in interface ArrayLengthProvider
public static Class<?> forClass(ResolvedJavaType type)