roll back breaking API change
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3609 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
1d99b357cf
commit
499738f3a3
|
@ -15,10 +15,13 @@ import com.ibm.wala.types.FieldReference;
|
|||
public class SSAAddressOfInstruction extends SSAInstruction {
|
||||
|
||||
private final int lval;
|
||||
|
||||
private final int addressVal;
|
||||
|
||||
private final int indexVal;
|
||||
|
||||
private final FieldReference field;
|
||||
|
||||
|
||||
public SSAAddressOfInstruction(int lval, int local) {
|
||||
this.lval = lval;
|
||||
this.addressVal = local;
|
||||
|
@ -48,7 +51,7 @@ public class SSAAddressOfInstruction extends SSAInstruction {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return lval * 99701 * addressVal;
|
||||
return lval * 99701 * addressVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,21 +61,24 @@ public class SSAAddressOfInstruction extends SSAInstruction {
|
|||
|
||||
@Override
|
||||
public String toString(SymbolTable symbolTable) {
|
||||
return getValueString(symbolTable, lval) + " = &" + getValueString(symbolTable, addressVal) +
|
||||
( (indexVal != -1)? "[" + getValueString(symbolTable, indexVal) + "]":
|
||||
(field != null)? "." + field.getName().toString(): "");
|
||||
return getValueString(symbolTable, lval)
|
||||
+ " = &"
|
||||
+ getValueString(symbolTable, addressVal)
|
||||
+ ((indexVal != -1) ? "[" + getValueString(symbolTable, indexVal) + "]" : (field != null) ? "."
|
||||
+ field.getName().toString() : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(IVisitor v) {
|
||||
v.visitAddressOf(this);
|
||||
// SJF ... the API change to IVisitor temporarily rolled back since it breaks clients.
|
||||
// v.visitAddressOf(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfDefs() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getDef(int i) {
|
||||
assert i == 0;
|
||||
|
@ -86,13 +92,13 @@ public class SSAAddressOfInstruction extends SSAInstruction {
|
|||
|
||||
@Override
|
||||
public int getNumberOfUses() {
|
||||
return (indexVal == -1)? 1: 2;
|
||||
return (indexVal == -1) ? 1 : 2;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getUse(int i) {
|
||||
assert i == 0 || (i == 1 && indexVal != -1);
|
||||
if (i == 0) {
|
||||
if (i == 0) {
|
||||
return addressVal;
|
||||
} else {
|
||||
return indexVal;
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.ibm.wala.types.TypeReference;
|
|||
/**
|
||||
* An instruction in SSA form.
|
||||
*/
|
||||
public abstract class SSAInstruction {
|
||||
public abstract class SSAInstruction {
|
||||
|
||||
/**
|
||||
* prevent instantiation by the outside
|
||||
|
@ -27,17 +27,15 @@ public abstract class SSAInstruction {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method is meant to be used during SSA conversion for an IR that is not in SSA form. It creates a new
|
||||
* SSAInstruction of the same type as the receiver, with a combination of the receiver's uses and defs and those from
|
||||
* the method parameters.
|
||||
* This method is meant to be used during SSA conversion for an IR that is not in SSA form. It creates a new SSAInstruction of the
|
||||
* same type as the receiver, with a combination of the receiver's uses and defs and those from the method parameters.
|
||||
*
|
||||
* In particular, if the 'defs' parameter is null, then the new instruction has the same defs as the receiver. If
|
||||
* 'defs' is not null, it must be an array with a size equal to the number of defs that the receiver instruction has.
|
||||
* In this case, the new instruction has defs taken from the array. The uses of the new instruction work in the same
|
||||
* way with the 'uses' parameter.
|
||||
* In particular, if the 'defs' parameter is null, then the new instruction has the same defs as the receiver. If 'defs' is not
|
||||
* null, it must be an array with a size equal to the number of defs that the receiver instruction has. In this case, the new
|
||||
* instruction has defs taken from the array. The uses of the new instruction work in the same way with the 'uses' parameter.
|
||||
*
|
||||
* Note that this only applies to CAst-based IR translation, since Java bytecode-based IR generation uses a different
|
||||
* SSA construction mechanism.
|
||||
* Note that this only applies to CAst-based IR translation, since Java bytecode-based IR generation uses a different SSA
|
||||
* construction mechanism.
|
||||
*
|
||||
* TODO: move this into the SSAInstructionFactory
|
||||
*/
|
||||
|
@ -59,8 +57,7 @@ public abstract class SSAInstruction {
|
|||
}
|
||||
|
||||
/**
|
||||
* Apply an IVisitor to this instruction. We invoke the appropriate IVisitor method according to the type of this
|
||||
* instruction.
|
||||
* Apply an IVisitor to this instruction. We invoke the appropriate IVisitor method according to the type of this instruction.
|
||||
*/
|
||||
public abstract void visit(IVisitor v);
|
||||
|
||||
|
@ -93,8 +90,10 @@ public abstract class SSAInstruction {
|
|||
void visitPut(SSAPutInstruction instruction);
|
||||
|
||||
void visitInvoke(SSAInvokeInstruction instruction);
|
||||
|
||||
void visitAddressOf(SSAAddressOfInstruction instruction);
|
||||
|
||||
// This would be a significant API change since any implementors of IVisitor
|
||||
// will break. We need to announce and discuss such API changes. -- SJF
|
||||
// void visitAddressOf(SSAAddressOfInstruction instruction);
|
||||
|
||||
void visitNew(SSANewInstruction instruction);
|
||||
|
||||
|
@ -122,9 +121,9 @@ public abstract class SSAInstruction {
|
|||
*/
|
||||
public static abstract class Visitor implements IVisitor {
|
||||
public void visitAddressOf(SSAAddressOfInstruction instruction) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void visitGoto(SSAGotoInstruction instruction) {
|
||||
}
|
||||
|
||||
|
@ -196,8 +195,8 @@ public abstract class SSAInstruction {
|
|||
}
|
||||
|
||||
/**
|
||||
* Does this instruction define a normal value, as distinct from a set of exceptions possibly thrown by it (e.g. for
|
||||
* invoke instructions).
|
||||
* Does this instruction define a normal value, as distinct from a set of exceptions possibly thrown by it (e.g. for invoke
|
||||
* instructions).
|
||||
*
|
||||
* @return true if the instruction does define a proper value.
|
||||
*/
|
||||
|
@ -211,6 +210,7 @@ public abstract class SSAInstruction {
|
|||
|
||||
/**
|
||||
* Return the ith def
|
||||
*
|
||||
* @param i number of the def, starting at 0.
|
||||
*/
|
||||
public int getDef(int i) {
|
||||
|
@ -248,7 +248,7 @@ public abstract class SSAInstruction {
|
|||
* @return the set of exception types that an instruction might throw ... disregarding athrows and invokes.
|
||||
*/
|
||||
public Collection<TypeReference> getExceptionTypes() {
|
||||
assert ! isPEI();
|
||||
assert !isPEI();
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue