Skip to content

Commit

Permalink
Remove unneeded method load call
Browse files Browse the repository at this point in the history
  • Loading branch information
NebelNidas committed Jun 2, 2022
1 parent ce78a62 commit 235991f
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions jadx-core/src/main/java/jadx/core/deobf/Deobfuscator.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import jadx.core.dex.nodes.FieldNode;
import jadx.core.dex.nodes.MethodNode;
import jadx.core.dex.nodes.RootNode;
import jadx.core.utils.exceptions.DecodeException;
import jadx.core.utils.kotlin.KotlinMetadataUtils;

public class Deobfuscator {
Expand Down Expand Up @@ -252,27 +251,18 @@ public void exportMappings(Path path, JadxCodeData codeData, MappingFormat mappi
if (!methodsWithMappedElements.contains(methodInfo.getDeclClass() + methodInfo.getShortId())) {
continue;
}
boolean wasLoaded = mth.isLoaded();
try {
mth.load();
int lvIndex = mth.getAccessFlags().isStatic() ? 0 : 1;
for (VarNode arg : collectMethodArgs(mth)) {
int ssaVersion = arg.getSsa();
String key = methodInfo.getDeclClass() + methodInfo.getShortId()
+ JadxCodeRef.forVar(arg.getReg(), ssaVersion);
if (mappedMethodArgsAndVars.containsKey(key)) {
mappingTree.visitClass(classPath);
mappingTree.visitMethod(methodName, methodDesc);
mappingTree.visitMethodArg(arg.getReg(), lvIndex, null);
mappingTree.visitDstName(MappedElementKind.METHOD_ARG, 0, mappedMethodArgsAndVars.get(key));
}
lvIndex += Math.max(arg.getType().getRegCount(), 1);
int lvIndex = mth.getAccessFlags().isStatic() ? 0 : 1;
for (VarNode arg : collectMethodArgs(mth)) {
int ssaVersion = arg.getSsa();
String key = methodInfo.getDeclClass() + methodInfo.getShortId()
+ JadxCodeRef.forVar(arg.getReg(), ssaVersion);
if (mappedMethodArgsAndVars.containsKey(key)) {
mappingTree.visitClass(classPath);
mappingTree.visitMethod(methodName, methodDesc);
mappingTree.visitMethodArg(arg.getReg(), lvIndex, null);
mappingTree.visitDstName(MappedElementKind.METHOD_ARG, 0, mappedMethodArgsAndVars.get(key));
}
} catch (DecodeException e) {
LOG.error("Error while decompiling method " + methodInfo.getShortId());
}
if (!wasLoaded) {
mth.unload();
lvIndex += Math.max(arg.getType().getRegCount(), 1);
}
}
}
Expand Down

0 comments on commit 235991f

Please sign in to comment.