Skip to content

Commit

Permalink
Merge pull request #2016 from MarcMil/small-opt
Browse files Browse the repository at this point in the history
New ValueBox constructor for JInstanceFieldRefs
  • Loading branch information
StevenArzt authored Nov 6, 2023
2 parents 198676e + 1dde3ea commit 9427127
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/main/java/soot/jimple/internal/JInstanceFieldRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@

import soot.SootFieldRef;
import soot.Value;
import soot.ValueBox;
import soot.jimple.Jimple;

public class JInstanceFieldRef extends AbstractInstanceFieldRef {
public JInstanceFieldRef(Value base, SootFieldRef fieldRef) {
super(Jimple.v().newLocalBox(base), fieldRef);
}

public JInstanceFieldRef(ValueBox baseBox, SootFieldRef fieldRef) {
super(baseBox, fieldRef);
}

public Object clone() {
return new JInstanceFieldRef(Jimple.cloneIfNecessary(getBase()), fieldRef);
}
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/soot/jimple/spark/internal/TypeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import soot.AnySubType;
import soot.ArrayType;
import soot.FastHierarchy;
Expand Down Expand Up @@ -112,14 +113,15 @@ final public BitVector get(Type type) {
if (type == null) {
return null;
}
final Scene sc = Scene.v();
while (allocNodeListener.hasNext()) {
AllocNode n = allocNodeListener.next();
Type nt = n.getType();
Iterable<Type> types;
if (nt instanceof NullType || nt instanceof AnySubType) {
types = Scene.v().getTypeNumberer();
types = sc.getTypeNumberer();
} else {
types = Scene.v().getOrMakeFastHierarchy().canStoreTypeList(nt);
types = sc.getOrMakeFastHierarchy().canStoreTypeList(nt);
}
for (final Type t : types) {
if (!(t instanceof RefLikeType) || (t instanceof AnySubType) || isUnresolved(t)) {
Expand Down Expand Up @@ -156,8 +158,8 @@ final public BitVector get(Type type) {
}
}
logger.warn("Type mask not found for type " + type
+ ". This is casued by a cast operation to a type which is a phantom class " +
"and no type mask was found. This may affect the precision of the point-to set.");
+ ". This is casued by a cast operation to a type which is a phantom class "
+ "and no type mask was found. This may affect the precision of the point-to set.");
BitVector soundOverApproxRet = new BitVector();
for (int i = 0; i <= 63; i++) {
soundOverApproxRet.set(i);
Expand Down

0 comments on commit 9427127

Please sign in to comment.