public class ArrayIndexOfNode extends FixedWithNextNode implements Canonicalizable, LIRLowerable, MemoryAccess
arrayPointer: pointer to a java array or native memory location.arrayOffset: byte offset to be added to the array pointer. If arrayKind is
JavaKind.Void, this offset must include the array base offset!arrayLength: array length respective to the element size given by
stride.fromIndex: start index of the indexOf search, respective to the element size given by
stride.searchValues: between 1-4 int values to be searched. These values are ALWAYS expected
to be INT (4 bytes), if the stride is smaller, they should be zero-extended!findTwoConsecutive and withMask determine the search
algorithm:
false, the operation finds the index of the first occurrence of
any of the 1-4 searchValues.findTwoConsecutive is true and withMask is false, the
number of search values must be two. The operation will then search for the first occurrence of
both values in succession.withMask is true and findTwoConsecutive is false, the
number of search values must be two. The operation will then search for the first index i
where (array[i] | searchValues[1]) == searchValues[0].findTwoConsecutive is true and withMask is true, the
number of search values must be four. The operation will then search for the first index
i where
(array[i] | searchValues[2]) == searchValues[0] && (array[i + 1] | searchValues[3]) == searchValues[1].Node.ConstantNodeParameter, Node.EdgeVisitor, Node.IndirectCanonicalization, Node.InjectedNodeParameter, Node.Input, Node.NodeInsertionStackTrace, Node.NodeIntrinsic, Node.NodeIntrinsicFactory, Node.OptionalInput, Node.Successor, Node.ValueNumberableCanonicalizable.Binary<T extends Node>, Canonicalizable.BinaryCommutative<T extends Node>, Canonicalizable.Ternary<T extends Node>, Canonicalizable.Unary<T extends Node>| Modifier and Type | Field and Description |
|---|---|
static NodeClass<ArrayIndexOfNode> |
TYPE |
nextEMPTY_ARRAY, stampNODE_LIST, NOT_ITERABLE, TRACK_CREATION_POSITION, WithAllEdges, WithNoEdges, WithOnlyInputEdges, WithOnlySucessorEdges| Constructor and Description |
|---|
ArrayIndexOfNode(JavaKind arrayKind,
JavaKind stride,
boolean findTwoConsecutive,
boolean withMask,
org.graalvm.word.LocationIdentity locationIdentity,
ValueNode arrayPointer,
ValueNode arrayOffset,
ValueNode arrayLength,
ValueNode fromIndex,
ValueNode... searchValues) |
ArrayIndexOfNode(JavaKind arrayKind,
JavaKind stride,
boolean findTwoConsecutive,
boolean withMask,
ValueNode arrayPointer,
ValueNode arrayOffset,
ValueNode arrayLength,
ValueNode fromIndex,
ValueNode... searchValues) |
ArrayIndexOfNode(NodeClass<? extends ArrayIndexOfNode> c,
JavaKind arrayKind,
JavaKind stride,
boolean findTwoConsecutive,
boolean withMask,
org.graalvm.word.LocationIdentity locationIdentity,
ValueNode arrayPointer,
ValueNode arrayOffset,
ValueNode arrayLength,
ValueNode fromIndex,
ValueNode... searchValues) |
| Modifier and Type | Method and Description |
|---|---|
Node |
canonical(CanonicalizerTool tool)
Implementations of this method can provide local optimizations like constant folding and
strength reduction.
|
void |
generate(NodeLIRBuilderTool gen) |
protected int |
getArrayBaseOffset(MetaAccessProvider metaAccessProvider,
ValueNode array,
JavaKind kind) |
JavaKind |
getArrayKind() |
ValueNode |
getArrayLength() |
ValueNode |
getArrayOffset() |
ValueNode |
getArrayPointer() |
ValueNode |
getFromIndex() |
MemoryKill |
getLastLocationAccess() |
org.graalvm.word.LocationIdentity |
getLocationIdentity() |
int |
getNumberOfValues() |
NodeInputList<ValueNode> |
getSearchValues() |
JavaKind |
getStride() |
static int |
indexOf(JavaKind arrayKind,
JavaKind stride,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1) |
static int |
indexOf2Consecutive(JavaKind arrayKind,
JavaKind stride,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1,
int v2) |
boolean |
isFindTwoConsecutive() |
boolean |
isWithMask() |
static int |
optimizedArrayIndexOf(JavaKind arrayKind,
JavaKind valueKind,
boolean findTwoConsecutive,
boolean withMask,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1) |
static int |
optimizedArrayIndexOf(JavaKind arrayKind,
JavaKind valueKind,
boolean findTwoConsecutive,
boolean withMask,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1,
int v2) |
static int |
optimizedArrayIndexOf(JavaKind arrayKind,
JavaKind valueKind,
boolean findTwoConsecutive,
boolean withMask,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1,
int v2,
int v3) |
static int |
optimizedArrayIndexOf(JavaKind arrayKind,
JavaKind valueKind,
boolean findTwoConsecutive,
boolean withMask,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1,
int v2,
int v3,
int v4) |
void |
setLastLocationAccess(MemoryKill lla) |
asFixedWithNextNode, next, setNextasFixedNode, verifyasConstant, asJavaConstant, asNode, asSerializableConstant, checkReplaceAtUsagesInvariants, getStackKind, graph, hasUsagesOtherThan, inferStamp, isAllowedUsageType, isConstant, isConstantPredicate, isDefaultConstant, isIllegalConstant, isJavaConstant, isNullConstant, isSerializableConstant, recursivelyDataFlowEqualsUpTo, setStamp, stamp, updateStamp, updateUsagesInterfaceafterClone, applyInputs, applySuccessors, assertFalse, assertTrue, cfgPredecessors, cfgSuccessors, clearInputs, clearNodeSourcePosition, clearSuccessors, copyWithInputs, copyWithInputs, dataFlowEquals, dynamicNodeSizeEstimate, estimatedNodeCycles, estimatedNodeSize, fail, formatTo, getCreationPosition, getDebug, getDebugProperties, getDebugProperties, getInsertionPosition, getNodeClass, getNodeSourcePosition, getOptions, getUsageCount, hasExactlyOneUsage, 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, toString, updateNodeSourcePosition, updatePredecessor, updateUsages, usages, valueEquals, verifyEdges, verifyInputs, verifySourcePosition, withNodeSourcePositionclone, equals, getClass, notify, notifyAll, wait, wait, waitasNodeasFixedNodepublic static final NodeClass<ArrayIndexOfNode> TYPE
public ArrayIndexOfNode(JavaKind arrayKind,
JavaKind stride,
boolean findTwoConsecutive,
boolean withMask,
ValueNode arrayPointer,
ValueNode arrayOffset,
ValueNode arrayLength,
ValueNode fromIndex,
ValueNode... searchValues)
public ArrayIndexOfNode(JavaKind arrayKind,
JavaKind stride,
boolean findTwoConsecutive,
boolean withMask,
org.graalvm.word.LocationIdentity locationIdentity,
ValueNode arrayPointer,
ValueNode arrayOffset,
ValueNode arrayLength,
ValueNode fromIndex,
ValueNode... searchValues)
public ArrayIndexOfNode(NodeClass<? extends ArrayIndexOfNode> c, JavaKind arrayKind, JavaKind stride, boolean findTwoConsecutive, boolean withMask, org.graalvm.word.LocationIdentity locationIdentity, ValueNode arrayPointer, ValueNode arrayOffset, ValueNode arrayLength, ValueNode fromIndex, ValueNode... searchValues)
public JavaKind getArrayKind()
public boolean isFindTwoConsecutive()
public boolean isWithMask()
public ValueNode getArrayPointer()
public ValueNode getArrayOffset()
public ValueNode getArrayLength()
public ValueNode getFromIndex()
public NodeInputList<ValueNode> getSearchValues()
public int getNumberOfValues()
public JavaKind getStride()
public void generate(NodeLIRBuilderTool gen)
generate in interface LIRLowerableprotected int getArrayBaseOffset(MetaAccessProvider metaAccessProvider,
ValueNode array,
JavaKind kind)
public org.graalvm.word.LocationIdentity getLocationIdentity()
getLocationIdentity in interface MemoryAccesspublic Node canonical(CanonicalizerTool tool)
Canonicalizablenull will delete the current node and replace it with null at
all usages. Note that it is not necessary to delete floating nodes that have no more usages
this way - they will be deleted automatically.canonical in interface Canonicalizabletool - provides access to runtime interfaces like MetaAccessProviderpublic MemoryKill getLastLocationAccess()
getLastLocationAccess in interface MemoryAccesspublic void setLastLocationAccess(MemoryKill lla)
setLastLocationAccess in interface MemoryAccesslla - the MemoryKill that represents the last kill of the
LocationIdentity returned by MemoryAccess.getLocationIdentity()public static int optimizedArrayIndexOf(JavaKind arrayKind,
JavaKind valueKind,
boolean findTwoConsecutive,
boolean withMask,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1)
public static int optimizedArrayIndexOf(JavaKind arrayKind,
JavaKind valueKind,
boolean findTwoConsecutive,
boolean withMask,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1,
int v2)
public static int optimizedArrayIndexOf(JavaKind arrayKind,
JavaKind valueKind,
boolean findTwoConsecutive,
boolean withMask,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1,
int v2,
int v3)
public static int optimizedArrayIndexOf(JavaKind arrayKind,
JavaKind valueKind,
boolean findTwoConsecutive,
boolean withMask,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1,
int v2,
int v3,
int v4)
public static int indexOf(JavaKind arrayKind,
JavaKind stride,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1)
public static int indexOf2Consecutive(JavaKind arrayKind,
JavaKind stride,
Object array,
long arrayOffset,
int arrayLength,
int fromIndex,
int v1,
int v2)