public final class IntegerStamp extends PrimitiveStamp
SpeculationReasonGroup.SpeculationContextObject.Visitor| Modifier and Type | Field and Description |
|---|---|
static ArithmeticOpTable |
OPS |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
addCanOverflow(IntegerStamp a,
IntegerStamp b) |
static boolean |
addOverflowsNegatively(long x,
long y,
int bits) |
static boolean |
addOverflowsPositively(long x,
long y,
int bits) |
JavaConstant |
asConstant()
If this stamp represents a single value, the methods returns this single value.
|
boolean |
canBeNegative() |
boolean |
canBePositive() |
static long |
carryBits(long x,
long y) |
Stamp |
constant(Constant c,
MetaAccessProvider meta)
If it is possible to represent single value stamps of this kind, this method returns the
stamp representing the single value c.
|
boolean |
contains(long value) |
static IntegerStamp |
create(int bits,
long lowerBoundInput,
long upperBoundInput) |
static IntegerStamp |
create(int bits,
long lowerBoundInput,
long upperBoundInput,
long downMask,
long upMask) |
static IntegerStamp |
create(int bits,
long lowerBoundInput,
long upperBoundInput,
long downMask,
long upMask,
boolean canBeZero) |
SerializableConstant |
deserialize(ByteBuffer buffer) |
long |
downMask()
This bit-mask describes the bits that are always set in the value described by this stamp.
|
IntegerStamp |
empty()
Returns a stamp of the same kind, but with no allowed values.
|
boolean |
equals(Object obj) |
LIRKind |
getLIRKind(LIRKindTool tool)
Gets a platform dependent
LIRKind that can be used to store a value of this stamp. |
JavaKind |
getStackKind()
Gets a Java
JavaKind that can be used to store a value of this stamp on the Java
bytecode stack. |
int |
hashCode() |
boolean |
hasValues()
Test whether this stamp has legal values.
|
boolean |
isCompatible(Constant constant)
Check that the constant
other is compatible with this stamp. |
boolean |
isCompatible(Stamp stamp)
Check that the constant
other is compatible with this stamp. |
boolean |
isNegative() |
boolean |
isPositive() |
boolean |
isStrictlyNegative() |
boolean |
isStrictlyPositive() |
boolean |
isUnrestricted()
Tests whether this stamp represents all values of this kind.
|
ResolvedJavaType |
javaType(MetaAccessProvider metaAccess)
Returns the type of the stamp, guaranteed to be non-null.
|
IntegerStamp |
join(Stamp otherStamp)
Returns the intersection of this stamp and the given stamp.
|
long |
lowerBound()
The signed inclusive lower bound on the value described by this stamp.
|
Stamp |
meet(Stamp otherStamp)
Returns the union of this stamp and the given stamp.
|
static boolean |
multiplicationCanOverflow(IntegerStamp a,
IntegerStamp b) |
static boolean |
multiplicationOverflows(long a,
long b,
int bits) |
static boolean |
negateCanOverflow(IntegerStamp stamp)
Returns if
stamp can overflow when applying negation. |
Constant |
readConstant(MemoryAccessProvider provider,
Constant base,
long displacement,
Stamp accessStamp)
Read a value of this stamp from memory where the underlying storage might be of a different
size.
|
static boolean |
sameSign(IntegerStamp s1,
IntegerStamp s2)
Checks if the 2 stamps represent values of the same sign.
|
static IntegerStamp |
stampForMask(int bits,
long downMask,
long upMask) |
static boolean |
subtractionCanOverflow(IntegerStamp x,
IntegerStamp y) |
static boolean |
subtractionOverflows(long x,
long y,
int bits) |
String |
toString() |
IntegerStamp |
unrestricted()
Returns a stamp of the same kind, but allowing the full value range of the kind.
|
long |
unsignedLowerBound() |
long |
unsignedUpperBound() |
long |
upMask()
This bit-mask describes the bits that can be set in the value described by this stamp.
|
long |
upperBound()
The signed inclusive upper bound on the value described by this stamp.
|
accept, getBits, getBits, readConstant, readJavaConstantgetOps, improveWithalwaysDistinct, isEmpty, isPointerStamp, makeSymbolic, neverDistinct, tryImproveWithpublic static final ArithmeticOpTable OPS
public static IntegerStamp create(int bits, long lowerBoundInput, long upperBoundInput)
public static IntegerStamp create(int bits, long lowerBoundInput, long upperBoundInput, long downMask, long upMask)
public static IntegerStamp create(int bits, long lowerBoundInput, long upperBoundInput, long downMask, long upMask, boolean canBeZero)
public static IntegerStamp stampForMask(int bits, long downMask, long upMask)
public IntegerStamp unrestricted()
StampStamp.unrestricted() is the neutral element of the Stamp.join(Stamp) operation.unrestricted in class Stamppublic IntegerStamp empty()
StampStamp.empty() is the neutral element of the Stamp.meet(Stamp) operation.public Stamp constant(Constant c, MetaAccessProvider meta)
StampIf it is not possible to represent single value stamps, this method returns a stamp that includes c, and is otherwise as narrow as possible.
public SerializableConstant deserialize(ByteBuffer buffer)
deserialize in class ArithmeticStamppublic boolean hasValues()
Stamppublic JavaKind getStackKind()
StampJavaKind that can be used to store a value of this stamp on the Java
bytecode stack. Returns JavaKind.Illegal if a value of this stamp can not be stored
on the bytecode stack.getStackKind in class Stamppublic LIRKind getLIRKind(LIRKindTool tool)
StampLIRKind that can be used to store a value of this stamp.getLIRKind in class Stamppublic ResolvedJavaType javaType(MetaAccessProvider metaAccess)
StampMetaAccessProvider is mandatory.public Constant readConstant(MemoryAccessProvider provider,
Constant base,
long displacement,
Stamp accessStamp)
StampaccessStamp is used to specify the size of access if it differs from the size
of the result.readConstant in class Stamppublic long lowerBound()
public long upperBound()
public long downMask()
public long upMask()
public boolean isUnrestricted()
StampisUnrestricted in class Stamppublic boolean contains(long value)
public boolean isPositive()
public boolean isNegative()
public boolean isStrictlyPositive()
public boolean isStrictlyNegative()
public boolean canBePositive()
public boolean canBeNegative()
public Stamp meet(Stamp otherStamp)
Stamppublic IntegerStamp join(Stamp otherStamp)
Stamppublic boolean isCompatible(Stamp stamp)
Stampother is compatible with this stamp.isCompatible in class Stamppublic boolean isCompatible(Constant constant)
Stampother is compatible with this stamp.isCompatible in class Stamppublic long unsignedUpperBound()
public long unsignedLowerBound()
public int hashCode()
hashCode in class PrimitiveStamppublic boolean equals(Object obj)
equals in class PrimitiveStamppublic static boolean sameSign(IntegerStamp s1, IntegerStamp s2)
public JavaConstant asConstant()
StampasConstant in class Stamppublic static boolean addCanOverflow(IntegerStamp a, IntegerStamp b)
public static boolean addOverflowsPositively(long x,
long y,
int bits)
public static boolean addOverflowsNegatively(long x,
long y,
int bits)
public static long carryBits(long x,
long y)
public static boolean multiplicationOverflows(long a,
long b,
int bits)
public static boolean multiplicationCanOverflow(IntegerStamp a, IntegerStamp b)
public static boolean subtractionCanOverflow(IntegerStamp x, IntegerStamp y)
public static boolean subtractionOverflows(long x,
long y,
int bits)
public static boolean negateCanOverflow(IntegerStamp stamp)
stamp can overflow when applying negation. It effectively tests if
stamp's value range contains the minimal value of an N-bits integer, where N is the
width in bits of the values described by stamp.Math.negateExact(int)