a few small renamings
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@1990 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
b73d347ca6
commit
52a725e7ee
|
@ -15,15 +15,15 @@ import com.ibm.wala.classLoader.ArrayClass;
|
|||
/**
|
||||
* A pointer key which represents the contents of an array instance.
|
||||
*/
|
||||
public final class ArrayInstanceKey extends AbstractFieldPointerKey implements FilteredPointerKey {
|
||||
public ArrayInstanceKey(InstanceKey instance) {
|
||||
public final class ArrayContentsKey extends AbstractFieldPointerKey implements FilteredPointerKey {
|
||||
public ArrayContentsKey(InstanceKey instance) {
|
||||
super(instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof ArrayInstanceKey) {
|
||||
ArrayInstanceKey other = (ArrayInstanceKey) obj;
|
||||
if (obj instanceof ArrayContentsKey) {
|
||||
ArrayContentsKey other = (ArrayContentsKey) obj;
|
||||
return instance.equals(other.instance);
|
||||
} else {
|
||||
return false;
|
|
@ -147,10 +147,10 @@ public class PointerKeyComparator implements Comparator {
|
|||
return -1;
|
||||
}
|
||||
|
||||
private int compareArrayKey(ArrayInstanceKey key1, Object key2) {
|
||||
if (key2 instanceof ArrayInstanceKey) {
|
||||
private int compareArrayKey(ArrayContentsKey key1, Object key2) {
|
||||
if (key2 instanceof ArrayContentsKey) {
|
||||
ArrayClass k1 = (ArrayClass)key1.getInstanceKey().getConcreteType();
|
||||
ArrayClass k2 = (ArrayClass)((ArrayInstanceKey)key2).getInstanceKey().getConcreteType();
|
||||
ArrayClass k2 = (ArrayClass)((ArrayContentsKey)key2).getInstanceKey().getConcreteType();
|
||||
int d1 = k1.getDimensionality();
|
||||
int d2 = k2.getDimensionality();
|
||||
if (d1 != d2) {
|
||||
|
@ -225,12 +225,12 @@ public class PointerKeyComparator implements Comparator {
|
|||
}
|
||||
|
||||
// at this point, neither key is local or retval, expretval, field, static
|
||||
else if (key1 instanceof ArrayInstanceKey) {
|
||||
return compareArrayKey((ArrayInstanceKey)key1, key2);
|
||||
else if (key1 instanceof ArrayContentsKey) {
|
||||
return compareArrayKey((ArrayContentsKey)key1, key2);
|
||||
}
|
||||
|
||||
else if (key2 instanceof ArrayInstanceKey) {
|
||||
return -1*compareArrayKey((ArrayInstanceKey)key2, key1);
|
||||
else if (key2 instanceof ArrayContentsKey) {
|
||||
return -1*compareArrayKey((ArrayContentsKey)key2, key1);
|
||||
}
|
||||
|
||||
else {
|
||||
|
|
|
@ -12,7 +12,7 @@ package com.ibm.wala.ipa.callgraph.propagation.cfa;
|
|||
|
||||
import com.ibm.wala.classLoader.IField;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ArrayInstanceKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ArrayContentsKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.FilteredPointerKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceFieldKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
|
@ -72,6 +72,6 @@ public class CFAPointerKeys implements PointerKeyFactory {
|
|||
}
|
||||
|
||||
public PointerKey getPointerKeyForArrayContents(InstanceKey I) {
|
||||
return new ArrayInstanceKey(I);
|
||||
return new ArrayContentsKey(I);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.ibm.wala.classLoader.IClass;
|
|||
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.AbstractPointerAnalysis;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ArrayInstanceKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ArrayContentsKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ConcreteTypeKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.FilteredPointerKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.HeapModel;
|
||||
|
@ -150,8 +150,8 @@ public class TypeBasedPointerAnalysis extends AbstractPointerAnalysis {
|
|||
} else if (key instanceof InstanceFieldKey) {
|
||||
InstanceFieldKey i = (InstanceFieldKey) key;
|
||||
return getCallGraph().getClassHierarchy().lookupClass(i.getField().getFieldTypeReference());
|
||||
} else if (key instanceof ArrayInstanceKey) {
|
||||
ArrayInstanceKey i = (ArrayInstanceKey) key;
|
||||
} else if (key instanceof ArrayContentsKey) {
|
||||
ArrayContentsKey i = (ArrayContentsKey) key;
|
||||
FilteredPointerKey.TypeFilter filter = i.getTypeFilter();
|
||||
Assertions._assert(filter instanceof FilteredPointerKey.SingleClassFilter);
|
||||
return ((FilteredPointerKey.SingleClassFilter)filter).getConcreteType();
|
||||
|
|
|
@ -17,14 +17,16 @@ import com.ibm.wala.util.Exceptions;
|
|||
import com.ibm.wala.util.debug.Assertions;
|
||||
|
||||
/**
|
||||
* SSA instruction representing an array load.
|
||||
*
|
||||
* @author sfink
|
||||
*
|
||||
*/
|
||||
public class SSAArrayLoadInstruction extends SSAArrayReferenceInstruction {
|
||||
private final int result;
|
||||
|
||||
SSAArrayLoadInstruction(int result, int arrayref, int index, TypeReference declaredType) {
|
||||
super(arrayref, index, declaredType);
|
||||
SSAArrayLoadInstruction(int result, int arrayref, int index, TypeReference elementType) {
|
||||
super(arrayref, index, elementType);
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
|
@ -37,7 +39,7 @@ public class SSAArrayLoadInstruction extends SSAArrayReferenceInstruction {
|
|||
throw new IllegalArgumentException("uses.length < 2");
|
||||
}
|
||||
return new SSAArrayLoadInstruction(defs == null ? result : defs[0], uses == null ? getArrayRef() : uses[0],
|
||||
uses == null ? getIndex() : uses[1], getDeclaredType());
|
||||
uses == null ? getIndex() : uses[1], getElementType());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,12 +23,12 @@ public abstract class SSAArrayReferenceInstruction extends SSAInstruction {
|
|||
|
||||
private final int index;
|
||||
|
||||
private final TypeReference declaredType;
|
||||
private final TypeReference elementType;
|
||||
|
||||
SSAArrayReferenceInstruction(int arrayref, int index, TypeReference declaredType) {
|
||||
SSAArrayReferenceInstruction(int arrayref, int index, TypeReference elementType) {
|
||||
this.arrayref = arrayref;
|
||||
this.index = index;
|
||||
this.declaredType = declaredType;
|
||||
this.elementType = elementType;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -44,8 +44,9 @@ public abstract class SSAArrayReferenceInstruction extends SSAInstruction {
|
|||
*/
|
||||
@Override
|
||||
public int getUse(int j) {
|
||||
if (Assertions.verifyAssertions)
|
||||
if (Assertions.verifyAssertions) {
|
||||
Assertions._assert(j <= 1);
|
||||
}
|
||||
return (j == 0) ? arrayref : index;
|
||||
}
|
||||
|
||||
|
@ -63,15 +64,15 @@ public abstract class SSAArrayReferenceInstruction extends SSAInstruction {
|
|||
return index;
|
||||
}
|
||||
|
||||
public TypeReference getDeclaredType() {
|
||||
return declaredType;
|
||||
public TypeReference getElementType() {
|
||||
return elementType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true iff this represents an aload of a primitive type element
|
||||
*/
|
||||
public boolean typeIsPrimitive() {
|
||||
return declaredType.isPrimitiveType();
|
||||
return elementType.isPrimitiveType();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -34,7 +34,7 @@ public class SSAArrayStoreInstruction extends SSAArrayReferenceInstruction {
|
|||
throw new IllegalArgumentException("uses.length < 3");
|
||||
}
|
||||
return new SSAArrayStoreInstruction(uses == null ? getArrayRef() : uses[0], uses == null ? getIndex() : uses[1],
|
||||
uses == null ? value : uses[2], getDeclaredType());
|
||||
uses == null ? value : uses[2], getElementType());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -388,7 +388,6 @@ public class SSABuilder extends AbstractIntStackMachine {
|
|||
*/
|
||||
@Override
|
||||
public void visitArrayLoad(com.ibm.wala.shrikeBT.ArrayLoadInstruction instruction) {
|
||||
|
||||
int index = workingState.pop();
|
||||
int arrayRef = workingState.pop();
|
||||
int result = reuseOrCreateDef();
|
||||
|
|
Loading…
Reference in New Issue