From dc9ff54a1047b407766feb76fef24cbdfb16b628 Mon Sep 17 00:00:00 2001 From: Steven Arzt Date: Fri, 18 Oct 2024 16:47:19 +0200 Subject: [PATCH] fixed a regression --- src/main/java/soot/dexpler/DexBody.java | 46 +++++++++++++++---------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/main/java/soot/dexpler/DexBody.java b/src/main/java/soot/dexpler/DexBody.java index 96c84219a04..ccfef6a86ca 100755 --- a/src/main/java/soot/dexpler/DexBody.java +++ b/src/main/java/soot/dexpler/DexBody.java @@ -805,7 +805,7 @@ public Body jimplify(Body b, SootMethod m) { UnconditionalBranchFolder.v().transform(jBody); } DexFillArrayDataTransformer.v().transform(jBody); - //SharedInitializationLocalSplitter destroys the inserted casts, so we have to reintroduce them + // SharedInitializationLocalSplitter destroys the inserted casts, so we have to reintroduce them MultiMap maybetypeConstraints = new HashMultiMap<>(); handleKnownDexTypes(b, jimple); handleKnownDexArrayTypes(b, jimple, maybetypeConstraints); @@ -832,7 +832,7 @@ protected Collection reduceToAllowedTypesForLocal(Collection lcas, L Set res = new HashSet<>(lcas); res.retainAll(constraints); if (res.isEmpty()) { - //No typing left + // No typing left res.addAll(lcas); res.addAll(constraints); return res; @@ -852,11 +852,11 @@ protected CastInsertionUseVisitor createCastInsertionUseVisitor(soot.jimple.tool @Override public Value visit(Value op, Type useType, Stmt stmt, boolean checkOnly) { if (op instanceof LongConstant && useType instanceof DoubleType) { - //no cast necessary for Dex + // no cast necessary for Dex return op; } if (op instanceof IntConstant && useType instanceof FloatType) { - //no cast necessary for Dex + // no cast necessary for Dex return op; } return super.visit(op, useType, stmt, checkOnly); @@ -1083,12 +1083,15 @@ public Value visit(Value op, Type useType, Stmt stmt, boolean checkOnly) { } /** - * For non-object array instructions, we know from the bytecode already what the types are, or at least - * we can reduce it to two possibilities (int/float or float/double). + * For non-object array instructions, we know from the bytecode already what the types are, or at least we can reduce it to + * two possibilities (int/float or float/double). * - * @param b the body - * @param jimple the jimple instance to use (caching is slightly faster) - * @param typeConstraints type constraints (these might be multiple valid possibilities) + * @param b + * the body + * @param jimple + * the jimple instance to use (caching is slightly faster) + * @param typeConstraints + * type constraints (these might be multiple valid possibilities) */ private void handleKnownDexArrayTypes(Body b, Jimple jimple, MultiMap typeConstraints) { @@ -1119,8 +1122,8 @@ private void handleKnownDexArrayTypes(Body b, Jimple jimple, MultiMap map, Type t) { /** * Removes all dexpler specific tags. Saves some memory. - * @param unit the statement + * + * @param unit + * the statement */ private void removeDexplerTags(Unit unit) { - for (Tag t : unit.getTags()) { + for (Iterator it = unit.getTags().iterator(); it.hasNext();) { + Tag t = it.next(); if (t instanceof DexplerTag) { - unit.removeTag(t.getName()); + it.remove(); } - } }