public abstract static class ArithmeticOpTable.BinaryOp<T> extends ArithmeticOpTable.Op
Modifier and Type | Class and Description |
---|---|
static class |
ArithmeticOpTable.BinaryOp.Add |
static class |
ArithmeticOpTable.BinaryOp.And |
static class |
ArithmeticOpTable.BinaryOp.Div |
static class |
ArithmeticOpTable.BinaryOp.Mul |
static class |
ArithmeticOpTable.BinaryOp.Or |
static class |
ArithmeticOpTable.BinaryOp.Rem |
static class |
ArithmeticOpTable.BinaryOp.Sub |
static class |
ArithmeticOpTable.BinaryOp.Xor |
Modifier and Type | Field and Description |
---|---|
private boolean |
associative |
private boolean |
commutative |
Modifier | Constructor and Description |
---|---|
protected |
BinaryOp(String operation,
boolean associative,
boolean commutative) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
abstract Constant |
foldConstant(Constant a,
Constant b)
Apply the operation to two Constants.
|
abstract Stamp |
foldStamp(Stamp a,
Stamp b)
Apply the operation to two Stamps.
|
Constant |
getZero(Stamp stamp)
Check whether this operation has a zero {@code z == a .
|
int |
hashCode() |
boolean |
isAssociative()
Checks whether this operation is associative.
|
boolean |
isCommutative()
Checks whether this operation is commutative.
|
boolean |
isNeutral(Constant n)
Check whether a
Constant is a neutral element for this operation. |
String |
toString() |
ArithmeticOpTable.BinaryOp<T> |
unwrap() |
private final boolean associative
private final boolean commutative
public abstract Constant foldConstant(Constant a, Constant b)
public final boolean isAssociative()
(a . b) . c == a . (b . c)
for all a, b, c. Note that you still have to be
careful with inverses. For example the integer subtraction operation will report
true
here, since you can still reassociate as long as the correct negations are
inserted.public final boolean isCommutative()
a . b == b . a
for all a, b.public boolean isNeutral(Constant n)
Constant
is a neutral element for this operation. A neutral
element is any element n
where a . n == a
for all a.n
- the Constant
that should be testeda
: a . n == a
public Constant getZero(Stamp stamp)
z == a . a
for each a. Examples of
operations having such an element are subtraction and exclusive-or. Note that this may be
different from the numbers tested by isNeutral(jdk.internal.jvmci.meta.Constant)
.stamp
- a Stamp
z
such that z == a . a
for each a
in
stamp
if it exists, otherwise null
public ArithmeticOpTable.BinaryOp<T> unwrap()
public int hashCode()
hashCode
in class ArithmeticOpTable.Op
public boolean equals(Object obj)
equals
in class ArithmeticOpTable.Op
public String toString()
toString
in class ArithmeticOpTable.Op