Package jadx.core.dex.visitors.blocks
Class BlockProcessor
java.lang.Object
jadx.core.dex.visitors.AbstractVisitor
jadx.core.dex.visitors.blocks.BlockProcessor
- All Implemented Interfaces:
IDexTreeVisitor
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidprivate static booleancheckLoops(MethodNode mth, BlockNode block) private static voidprivate static voidprivate static voidcomputeUnreachableFromBlock(Set<BlockNode> toRemove, BlockNode block, MethodNode mth) private static booleandeduplicateBlockInsns(MethodNode mth, BlockNode block) private static booleanduplicateSimpleMoveBlock(MethodNode mth, BlockNode block) Duplicate block if it contains only one 'move' insn and all predecessors are 'switch' and 'if'.private static booleanfixUnreachableSplitCross(MethodNode mth, BlockNode splitCross) Attempts to remove an unreachable synthetic split cross block that has been added previously, along with the associated bottom splitter.private static InsnNodegetInsnsFromEnd(BlockNode block, int number) getLastInsns(BlockNode blockNode, int sameInsnCount) private static intgetSameLastInsnCount(List<BlockNode> predecessors) private static booleanprivate static voidinsertAtStart(BlockNode block, List<InsnNode> insns) private static booleaninsertBlocksForBreak(MethodNode mth, LoopInfo loop) Insert additional blocks for possible 'break' insertionprivate static booleaninsertBlocksForContinue(MethodNode mth, LoopInfo loop) Insert additional blocks for possible 'continue' insertionprivate static booleaninsertPreHeader(MethodNode mth, LoopInfo loop) Insert simple path block before loop headerprivate static booleanisArgAssignInPred(List<BlockNode> preds, InsnArg arg) private static booleanisInsnsEquals(InsnNode insn, InsnNode otherInsn) private static booleanprivate static voidmarkLoops(MethodNode mth) private static voidmergeConstAndReturnBlocks(MethodNode mth, BlockNode retBlock, BlockNode pred) private static booleanprivate static booleanprivate static booleanonlySwitchAndIfInLastInsns(List<BlockNode> preds) private static voidprivate static voidprivate static voidregisterLoops(MethodNode mth) private static voidremoveFromMethod(Set<BlockNode> toRemove, MethodNode mth) static voidstatic voidremoveUnreachableBlock(BlockNode blockToRemove, MethodNode mth) private static voidprivate static booleanprivate static booleansimplifyLoopEnd(MethodNode mth, LoopInfo loop) private static booleanprivate static booleansplitLoops(MethodNode mth, BlockNode block, List<LoopInfo> loops) private static booleansplitReturn(MethodNode mth, BlockNode returnBlock) Splice return block if several predecessors presentsprivate static booleansplitThrow(MethodNode mth, BlockNode exitBlock) static voidRecalculate all additional info attached to blocks:(package private) static voidprivate static voidvoidvisit(MethodNode mth) Visit methodMethods inherited from class jadx.core.dex.visitors.AbstractVisitor
getName, init, toString, visit
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
DEBUG_MODS
private static final boolean DEBUG_MODS- See Also:
-
-
Constructor Details
-
BlockProcessor
public BlockProcessor()
-
-
Method Details
-
visit
Description copied from interface:IDexTreeVisitorVisit method- Specified by:
visitin interfaceIDexTreeVisitor- Overrides:
visitin classAbstractVisitor
-
processBlocksTree
-
updateBlocksData
Recalculate all additional info attached to blocks:- dominators - dominance frontier - post dominators (only if
AFlag.COMPUTE_POST_DOMadded to method) - loops and nested loop infoThis method should be called after changing a block tree in custom passes added before
BlockFinisher. -
updateCleanSuccessors
-
checkForUnreachableBlocks
-
fixUnreachableSplitCross
Attempts to remove an unreachable synthetic split cross block that has been added previously, along with the associated bottom splitter.- Parameters:
mth- the method containing the unreachable blocksplitCross- the unreachable block- Returns:
- true if the operation was successful, false if a precondition was not satisfied and no changes were made.
-
deduplicateBlockInsns
-
getLastInsns
-
insertAtStart
-
getSameLastInsnCount
-
isSame
-
isInsnsEquals
-
sameArgs
-
getInsnsFromEnd
-
computeDominators
-
markLoops
-
registerLoops
-
processNestedLoops
-
modifyBlocksTree
-
mergeConstReturn
-
mergeConstAndReturnBlocks
-
independentBlockTreeMod
-
duplicateSimpleMoveBlock
Duplicate block if it contains only one 'move' insn and all predecessors are 'switch' and 'if'. This will help to resolve switch cases order and fallthrough detection because such move blocks can be deduplicated by compiler. -
onlySwitchAndIfInLastInsns
-
simplifyLoopEnd
-
checkLoops
-
insertPreHeader
Insert simple path block before loop header -
insertBlocksForBreak
Insert additional blocks for possible 'break' insertion -
insertBlocksForContinue
Insert additional blocks for possible 'continue' insertion -
splitLoops
-
splitExitBlocks
-
updateExitBlockConnections
-
splitReturn
Splice return block if several predecessors presents -
splitThrow
-
isArgAssignInPred
-
removeMarkedBlocks
-
removeUnreachableBlocks
-
removeUnreachableBlock
-
computeUnreachableFromBlock
private static void computeUnreachableFromBlock(Set<BlockNode> toRemove, BlockNode block, MethodNode mth) -
removeFromMethod
-
clearBlocksState
-