use of jadx.core.dex.nodes.BlockNode in project jadx by skylot.
the class BlockExceptionHandler method process.
public static boolean process(MethodNode mth) {
if (mth.isNoExceptionHandlers()) {
return false;
}
BlockProcessor.updateCleanSuccessors(mth);
BlockProcessor.computeDominanceFrontier(mth);
processCatchAttr(mth);
initExcHandlers(mth);
List<TryCatchBlockAttr> tryBlocks = prepareTryBlocks(mth);
connectExcHandlers(mth, tryBlocks);
mth.addAttr(AType.TRY_BLOCKS_LIST, tryBlocks);
mth.getBasicBlocks().forEach(BlockNode::updateCleanSuccessors);
for (ExceptionHandler eh : mth.getExceptionHandlers()) {
removeMonitorExitFromExcHandler(mth, eh);
}
BlockProcessor.removeMarkedBlocks(mth);
return true;
}
use of jadx.core.dex.nodes.BlockNode in project jadx by skylot.
the class ConstInlineVisitor method process.
public static void process(MethodNode mth) {
List<InsnNode> toRemove = new ArrayList<>();
for (BlockNode block : mth.getBasicBlocks()) {
toRemove.clear();
for (InsnNode insn : block.getInstructions()) {
checkInsn(mth, insn, toRemove);
}
InsnRemover.removeAllAndUnbind(mth, block, toRemove);
}
}
use of jadx.core.dex.nodes.BlockNode in project jadx by skylot.
the class DeboxingVisitor method visit.
@Override
public void visit(MethodNode mth) throws JadxException {
if (mth.isNoCode()) {
return;
}
boolean replaced = false;
for (BlockNode blockNode : mth.getBasicBlocks()) {
List<InsnNode> insnList = blockNode.getInstructions();
int count = insnList.size();
for (int i = 0; i < count; i++) {
InsnNode insnNode = insnList.get(i);
if (insnNode.getType() == InsnType.INVOKE) {
InsnNode replaceInsn = checkForReplace(((InvokeNode) insnNode));
if (replaceInsn != null) {
BlockUtils.replaceInsn(mth, blockNode, i, replaceInsn);
replaced = true;
}
}
}
}
if (replaced) {
ConstInlineVisitor.process(mth);
}
}
use of jadx.core.dex.nodes.BlockNode in project jadx by skylot.
the class ExtractFieldInit method collectFieldsInit.
private static List<FieldInitInfo> collectFieldsInit(ClassNode cls, MethodNode mth, InsnType putType) {
List<FieldInitInfo> fieldsInit = new ArrayList<>();
Set<BlockNode> singlePathBlocks = new HashSet<>();
BlockUtils.visitSinglePath(mth.getEnterBlock(), singlePathBlocks::add);
for (BlockNode block : mth.getBasicBlocks()) {
for (InsnNode insn : block.getInstructions()) {
if (insn.getType() == putType) {
IndexInsnNode putInsn = (IndexInsnNode) insn;
FieldInfo field = (FieldInfo) putInsn.getIndex();
if (field.getDeclClass().equals(cls.getClassInfo())) {
FieldNode fn = cls.searchField(field);
if (fn != null) {
boolean singlePath = singlePathBlocks.contains(block);
fieldsInit.add(new FieldInitInfo(fn, putInsn, singlePath));
}
}
}
}
}
return fieldsInit;
}
use of jadx.core.dex.nodes.BlockNode in project jadx by skylot.
the class MoveInlineVisitor method moveInline.
public static void moveInline(MethodNode mth) {
InsnRemover remover = new InsnRemover(mth);
for (BlockNode block : mth.getBasicBlocks()) {
remover.setBlock(block);
for (InsnNode insn : block.getInstructions()) {
if (insn.getType() != InsnType.MOVE) {
continue;
}
if (processMove(mth, insn)) {
remover.addAndUnbind(insn);
}
}
remover.perform();
}
}
Aggregations