use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class TryCatchBlock method removeWholeBlock.
private void removeWholeBlock(MethodNode mth) {
// self destruction
for (Iterator<ExceptionHandler> it = handlers.iterator(); it.hasNext(); ) {
ExceptionHandler h = it.next();
unbindHandler(h);
it.remove();
}
for (InsnNode insn : insns) {
insn.removeAttr(attr);
}
insns.clear();
if (mth.getBasicBlocks() != null) {
for (BlockNode block : mth.getBasicBlocks()) {
block.removeAttr(attr);
}
}
}
use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class CodeShrinker method simplifyMoveInsns.
private static void simplifyMoveInsns(BlockNode block) {
List<InsnNode> insns = block.getInstructions();
int size = insns.size();
for (int i = 0; i < size; i++) {
InsnNode insn = insns.get(i);
if (insn.getType() == InsnType.MOVE) {
// replace 'move' with wrapped insn
InsnArg arg = insn.getArg(0);
if (arg.isInsnWrap()) {
InsnNode wrapInsn = ((InsnWrapArg) arg).getWrapInsn();
wrapInsn.setResult(insn.getResult());
wrapInsn.copyAttributesFrom(insn);
wrapInsn.setOffset(insn.getOffset());
wrapInsn.remove(AFlag.WRAPPED);
block.getInstructions().set(i, wrapInsn);
}
}
}
}
use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class InsnArg method wrapInstruction.
public InsnArg wrapInstruction(InsnNode insn) {
InsnNode parent = parentInsn;
if (parent == null) {
return null;
}
if (parent == insn) {
LOG.debug("Can't wrap instruction info itself: {}", insn);
return null;
}
int i = getArgIndex(parent, this);
if (i == -1) {
return null;
}
insn.add(AFlag.WRAPPED);
InsnArg arg = wrapArg(insn);
parent.setArg(i, arg);
return arg;
}
use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class InsnDecoder method process.
public InsnNode[] process() throws DecodeException {
InsnNode[] instructions = new InsnNode[insnArr.length];
for (int i = 0; i < insnArr.length; i++) {
DecodedInstruction rawInsn = insnArr[i];
if (rawInsn != null) {
InsnNode insn = decode(rawInsn, i);
if (insn != null) {
insn.setOffset(i);
}
instructions[i] = insn;
} else {
instructions[i] = null;
}
}
insnArr = null;
return instructions;
}
use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class InsnDecoder method arrayPut.
private InsnNode arrayPut(DecodedInstruction insn, ArgType argType) {
InsnNode inode = new InsnNode(InsnType.APUT, 3);
inode.addArg(InsnArg.reg(insn, 1, ArgType.unknown(PrimitiveType.ARRAY)));
inode.addArg(InsnArg.reg(insn, 2, ArgType.INT));
inode.addArg(InsnArg.reg(insn, 0, argType));
return inode;
}
Aggregations