core: fix various processing issues
This commit is contained in:
@@ -5,6 +5,7 @@ import jadx.core.dex.attributes.AType;
|
||||
import jadx.core.dex.attributes.AttrNode;
|
||||
import jadx.core.dex.attributes.nodes.IgnoreEdgeAttr;
|
||||
import jadx.core.dex.attributes.nodes.LoopInfo;
|
||||
import jadx.core.utils.EmptyBitSet;
|
||||
import jadx.core.utils.InsnUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -24,7 +25,7 @@ public class BlockNode extends AttrNode implements IBlock {
|
||||
private List<BlockNode> cleanSuccessors;
|
||||
|
||||
// all dominators
|
||||
private BitSet doms;
|
||||
private BitSet doms = EmptyBitSet.EMPTY;
|
||||
// dominance frontier
|
||||
private BitSet domFrontier;
|
||||
// immediate dominator
|
||||
|
||||
@@ -126,9 +126,11 @@ public class MethodNode extends LineAttrNode implements ILoadable {
|
||||
list.add(resultArg);
|
||||
}
|
||||
insnNode.getRegisterArgs(list);
|
||||
for (int i = 0, listSize = list.size(); i < listSize; i++) {
|
||||
int argsCount = list.size();
|
||||
for (int i = 0; i < argsCount; i++) {
|
||||
if (list.get(i).getRegNum() >= regsCount) {
|
||||
throw new JadxRuntimeException("Incorrect register number in instruction: " + insnNode);
|
||||
throw new JadxRuntimeException("Incorrect register number in instruction: " + insnNode
|
||||
+ ", expected to be less than " + regsCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,13 +106,17 @@ public class ConstInlineVisitor extends AbstractVisitor {
|
||||
continue;
|
||||
}
|
||||
LiteralArg litArg;
|
||||
ArgType argType = arg.getType();
|
||||
if (argType.isObject() && literal != 0) {
|
||||
argType = ArgType.NARROW_NUMBERS;
|
||||
}
|
||||
if (use.size() == 1 || arg.isTypeImmutable()) {
|
||||
// arg used only in one place
|
||||
litArg = InsnArg.lit(literal, arg.getType());
|
||||
litArg = InsnArg.lit(literal, argType);
|
||||
} else if (useInsn.getType() == InsnType.MOVE
|
||||
&& !useInsn.getResult().getType().isTypeKnown()) {
|
||||
// save type for 'move' instructions (hard to find type in chains of 'move')
|
||||
litArg = InsnArg.lit(literal, arg.getType());
|
||||
litArg = InsnArg.lit(literal, argType);
|
||||
} else {
|
||||
// in most cases type not equal arg.getType()
|
||||
// just set unknown type and run type fixer
|
||||
|
||||
@@ -912,7 +912,11 @@ public class RegionMaker {
|
||||
handler.setHandlerRegion(makeRegion(start, stack));
|
||||
|
||||
ExcHandlerAttr excHandlerAttr = start.get(AType.EXC_HANDLER);
|
||||
handler.getHandlerRegion().addAttr(excHandlerAttr);
|
||||
if (excHandlerAttr == null) {
|
||||
LOG.warn("Missing exception handler attribute for start block");
|
||||
} else {
|
||||
handler.getHandlerRegion().addAttr(excHandlerAttr);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isEqualPaths(BlockNode b1, BlockNode b2) {
|
||||
|
||||
@@ -88,8 +88,10 @@ public class PostTypeInference {
|
||||
case CHECK_CAST: {
|
||||
ArgType castType = (ArgType) ((IndexInsnNode) insn).getIndex();
|
||||
RegisterArg result = insn.getResult();
|
||||
ArgType resultType = result.getType();
|
||||
// don't override generic types of same base class
|
||||
boolean skip = castType.isObject() && castType.getObject().equals(result.getType().getObject());
|
||||
boolean skip = castType.isObject() && resultType.isObject()
|
||||
&& castType.getObject().equals(resultType.getObject());
|
||||
if (!skip) {
|
||||
// workaround for compiler bug (see TestDuplicateCast)
|
||||
result.getSVar().setType(castType);
|
||||
|
||||
@@ -18,7 +18,7 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
private static final Font DEFAULT_FONT = new JLabel().getFont();
|
||||
|
||||
static final Set<String> SKIP_FIELDS = new HashSet<String>(Arrays.asList(
|
||||
"files", "input", "outputDir", "printHelp"
|
||||
"files", "input", "outputDir", "verbose", "printHelp"
|
||||
));
|
||||
|
||||
private String lastOpenFilePath = USER_HOME;
|
||||
|
||||
Reference in New Issue
Block a user