public class IntegerStamp extends PrimitiveStamp
Modifier and Type | Field and Description |
---|---|
private long |
downMask |
private long |
lowerBound |
static ArithmeticOpTable |
OPS |
private long |
upMask |
private long |
upperBound |
Constructor and Description |
---|
IntegerStamp(int bits,
long lowerBound,
long upperBound,
long downMask,
long upMask) |
Modifier and Type | Method and Description |
---|---|
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) |
private Stamp |
createStamp(IntegerStamp other,
long newUpperBound,
long newLowerBound,
long newDownMask,
long newUpMask) |
SerializableConstant |
deserialize(ByteBuffer buffer) |
long |
downMask()
This bit-mask describes the bits that are always set in the value described by this stamp.
|
Stamp |
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. |
Kind |
getStackKind()
Gets a Java
Kind 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(Stamp stamp)
Test whether two stamps have the same base type.
|
boolean |
isNegative() |
boolean |
isPositive() |
boolean |
isStrictlyNegative() |
boolean |
isStrictlyPositive() |
boolean |
isUnrestricted() |
ResolvedJavaType |
javaType(MetaAccessProvider metaAccess)
Returns the type of the stamp, guaranteed to be non-null.
|
Stamp |
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 |
sameSign(IntegerStamp s1,
IntegerStamp s2)
Checks if the 2 stamps represent values of the same sign.
|
private static long |
saturate(long v,
int bits) |
static IntegerStamp |
stampForMask(int bits,
long downMask,
long upMask) |
String |
toString() |
IntegerStamp |
unrestricted()
Returns a stamp of the same kind, but allowing the full value range of the kind.
|
long |
upMask()
This bit-mask describes the bits that can be set in the value described by this stamp.
|
static long |
upMaskFor(int bits,
long lowerBound,
long upperBound) |
long |
upperBound()
The signed inclusive upper bound on the value described by this stamp.
|
getBits, getBits, readConstant
getOps, improveWith
alwaysDistinct, isEmpty, neverDistinct, tryImproveWith
private final long lowerBound
private final long upperBound
private final long downMask
private final long upMask
public static final ArithmeticOpTable OPS
public IntegerStamp(int bits, long lowerBound, long upperBound, long downMask, long upMask)
public static IntegerStamp stampForMask(int bits, long downMask, long upMask)
public IntegerStamp unrestricted()
Stamp
Stamp.unrestricted()
is the neutral element of the Stamp.join(Stamp)
operation.unrestricted
in class Stamp
public Stamp empty()
Stamp
Stamp.empty()
is the neutral element of the Stamp.meet(Stamp)
operation.public Stamp constant(Constant c, MetaAccessProvider meta)
Stamp
If 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 ArithmeticStamp
public boolean hasValues()
Stamp
public Kind getStackKind()
Stamp
Kind
that can be used to store a value of this stamp on the Java bytecode
stack. Returns Kind.Illegal
if a value of this stamp can not be stored on the
bytecode stack.getStackKind
in class Stamp
public LIRKind getLIRKind(LIRKindTool tool)
Stamp
LIRKind
that can be used to store a value of this stamp.getLIRKind
in class Stamp
public ResolvedJavaType javaType(MetaAccessProvider metaAccess)
Stamp
MetaAccessProvider
is mandatory.public long lowerBound()
public long upperBound()
public long downMask()
public long upMask()
public boolean isUnrestricted()
public boolean contains(long value)
public boolean isPositive()
public boolean isNegative()
public boolean isStrictlyPositive()
public boolean isStrictlyNegative()
public boolean canBePositive()
public boolean canBeNegative()
private Stamp createStamp(IntegerStamp other, long newUpperBound, long newLowerBound, long newDownMask, long newUpMask)
public Stamp meet(Stamp otherStamp)
Stamp
public Stamp join(Stamp otherStamp)
Stamp
public boolean isCompatible(Stamp stamp)
Stamp
isCompatible
in class Stamp
public int hashCode()
hashCode
in class PrimitiveStamp
public boolean equals(Object obj)
equals
in class PrimitiveStamp
public static long upMaskFor(int bits, long lowerBound, long upperBound)
public static boolean sameSign(IntegerStamp s1, IntegerStamp s2)
public JavaConstant asConstant()
Stamp
asConstant
in class Stamp
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)
private static long saturate(long v, int bits)