Skip to content

Commit

Permalink
Performance
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcMil committed Oct 21, 2024
1 parent 3299680 commit 987955d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/soot/dexpler/DexBody.java
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,15 @@ public Type promote(Type tlow, Type thigh) {

}

protected Type getDefiniteType(Local v) {
Collection<Type> r = definiteConstraints.get(v);
if (r != null && r.size() == 1) {
return r.iterator().next();
} else {
return null;
}
}

protected soot.jimple.toolkits.typing.fast.BytecodeHierarchy createBytecodeHierarchy() {
return new soot.jimple.toolkits.typing.fast.BytecodeHierarchy() {
public java.util.Collection<Type> lcas(Type a, Type b, boolean useWeakObjectType) {
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/soot/jimple/toolkits/typing/fast/TypeResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,14 @@ protected Collection<Typing> applyAssignmentConstraints(Typing tg, IEvalFunction
Value lhs = stmt.getLeftOp();
if (lhs instanceof Local) {
Local v = (Local) lhs;
Type t = getDefiniteType(v);
if (t != null) {
simple.set(i);
wl.clear(i);
tg.set(v, t);
continue;
}

if (singleAssignments.contains(v)) {
Collection<Type> d = ef.eval(tg, stmt.getRightOp(), stmt);
if (d.size() == 1) {
Expand Down Expand Up @@ -699,6 +707,10 @@ protected Collection<Typing> applyAssignmentConstraints(Typing tg, IEvalFunction
return r;
}

protected Type getDefiniteType(Local v) {
return null;
}

protected Collection<Type> reduceToAllowedTypesForLocal(Collection<Type> lcas, Local v) {
return lcas;
}
Expand Down

0 comments on commit 987955d

Please sign in to comment.