Commit aac041f9 authored by Skylot's avatar Skylot

core: fix logs and code style

parent 6ef16000
......@@ -212,21 +212,16 @@ public class DebugInfoParser {
prev.end(addr, line);
setVar(prev);
}
RegisterArg activeReg = (RegisterArg) activeRegisters[var.getRegNum()];
if (activeReg != null) {
SSAVar ssaVar = activeReg.getSVar();
if ((ssaVar != null) && (ssaVar.getStartAddr() != -1)) {
if (ssaVar.getAssign() != null) {
if (ssaVar.getAssign().getParentInsn() != null) {
if (ssaVar.getAssign().getParentInsn().getOffset() >= 0) {
addr = ssaVar.getAssign().getParentInsn().getOffset();
}
}
InsnArg activeReg = activeRegisters[var.getRegNum()];
if (activeReg instanceof RegisterArg) {
SSAVar ssaVar = ((RegisterArg) activeReg).getSVar();
if (ssaVar != null && ssaVar.getStartAddr() != -1) {
InsnNode parentInsn = ssaVar.getAssign().getParentInsn();
if (parentInsn != null && parentInsn.getOffset() >= 0) {
addr = parentInsn.getOffset();
}
}
}
var.start(addr, line);
locals[regNum] = var;
}
......
......@@ -21,7 +21,6 @@ import jadx.core.dex.nodes.BlockNode;
import jadx.core.dex.nodes.InsnNode;
import jadx.core.dex.nodes.MethodNode;
import jadx.core.dex.regions.conditions.IfCondition;
import jadx.core.utils.InsnUtils;
import java.util.ArrayList;
import java.util.Collections;
......@@ -79,29 +78,17 @@ public class SimplifyVisitor extends AbstractVisitor {
case CHECK_CAST:
InsnArg castArg = insn.getArg(0);
ArgType castArgType = castArg.getType();
ArgType argType = castArg.getType();
/*
* Don't removes CHECK_CAST for wrapped INVOKE
* if invoked method returns different type
*/
// Don't removes CHECK_CAST for wrapped INVOKE if invoked method returns different type
if (castArg.isInsnWrap()) {
InsnWrapArg castWrapArg = (InsnWrapArg) castArg;
InsnNode wrapInsn = castWrapArg.getWrapInsn();
InsnNode wrapInsn = ((InsnWrapArg) castArg).getWrapInsn();
if (wrapInsn.getType() == InsnType.INVOKE) {
InvokeNode invkInsn = (InvokeNode) wrapInsn;
castArgType = invkInsn.getCallMth().getReturnType();
if (invkInsn.getResult().getType()
!= invkInsn.getCallMth().getReturnType()) {
LOG.warn("Invoke without cast at {} in {}", InsnUtils.formatOffset(invkInsn.getOffset()), mth);
}
argType = ((InvokeNode) wrapInsn).getCallMth().getReturnType();
}
}
ArgType castType = (ArgType) ((IndexInsnNode) insn).getIndex();
if (!ArgType.isCastNeeded(castArgType, castType)) {
ArgType castToType = (ArgType) ((IndexInsnNode) insn).getIndex();
if (!ArgType.isCastNeeded(argType, castToType)) {
InsnNode insnNode = new InsnNode(InsnType.MOVE, 1);
insnNode.setOffset(insn.getOffset());
insnNode.setResult(insn.getResult());
......
......@@ -693,7 +693,7 @@ public class RegionMaker {
// check cases order if fall through case exists
if (!fallThroughCases.isEmpty()) {
if (isBadCasesOrder(blocksMap, fallThroughCases)) {
LOG.debug("Fixing incorrect switch cases order");
LOG.debug("Fixing incorrect switch cases order, method: {}", mth);
blocksMap = reOrderSwitchCases(blocksMap, fallThroughCases);
if (isBadCasesOrder(blocksMap, fallThroughCases)) {
LOG.error("Can't fix incorrect switch cases order, method: {}", mth);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment