public final class StrideUtil extends Object
org.graalvm.compiler.replacements.nodes.ArrayRegionCompareToNode. These intrinsics may
work with fixed strides of 1, 2 or 4 bytes per element, or with a dynamic parameter containing
the stride in log2 format, i.e. 0 -> 1 byte, 1 -> 2 byte, 2 -> 4 byte. If an intrinsic
method has two array parameters with potentially different strides, both log2 stride values are
encoded into one as follows: (strideA * N_STRIDES) + strideB. This value is used inside
the intrinsic as a jump table index to dispatch to separately compiled versions for each possible
combination of strides.| Modifier and Type | Field and Description |
|---|---|
static int |
N_STRIDES
Number of possible values of a single stride parameter.
|
static JavaKind |
NONE
Alias for intrinsics that take a
JavaKind parameter to declare the type of an array
parameter. |
static JavaKind |
S1
Short aliases for intrinsics that take
JavaKind parameters to describe a stride in
bytes. |
static JavaKind |
S2 |
static JavaKind |
S4 |
| Constructor and Description |
|---|
StrideUtil() |
| Modifier and Type | Method and Description |
|---|---|
static JavaKind |
getConstantStrideA(int directStubCallIndex)
Extract
strideA from directStubCallIndex. |
static JavaKind |
getConstantStrideB(int directStubCallIndex)
Extract
strideB from directStubCallIndex. |
static int |
getDirectStubCallIndex(int log2StrideA,
int log2StrideB)
Encode the given stride values into one direct stub call index.
|
static int |
log2(JavaKind stride)
Get the given stride's log2 form.
|
static JavaKind |
log2ToStride(int log2Stride)
Convert the given log2 stride value to a
JavaKind value. |
static boolean |
useConstantStrides(Value dynamicStride)
Returns
true if the dynamicStride parameter is unused, which implies constant
strides must be used instead. |
public static final int N_STRIDES
public static final JavaKind S1
JavaKind parameters to describe a stride in
bytes. The naming is "S" for "stride", followed by the stride width in bytes.public static final JavaKind S2
public static final JavaKind S4
public static final JavaKind NONE
JavaKind parameter to declare the type of an array
parameter. This parameter "NONE" means that the array type is unknown or a native buffer has
been used instead.public static JavaKind getConstantStrideA(int directStubCallIndex)
strideA from directStubCallIndex.public static JavaKind getConstantStrideB(int directStubCallIndex)
strideB from directStubCallIndex.public static int getDirectStubCallIndex(int log2StrideA,
int log2StrideB)
public static int log2(JavaKind stride)
public static JavaKind log2ToStride(int log2Stride)
JavaKind value.public static boolean useConstantStrides(Value dynamicStride)
true if the dynamicStride parameter is unused, which implies constant
strides must be used instead.