Class SwitchRegionMaker
java.lang.Object
jadx.core.dex.visitors.regions.maker.SwitchRegionMaker
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final MethodNodeprivate final RegionMaker -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddCases(SwitchRegion sw, @Nullable BlockNode out, RegionStack stack, Map<BlockNode, List<Object>> blocksMap) private BlockNodeallSameReturns(RegionStack stack) static InsnContainerbuildBreakContainer(SwitchRegion switchRegion) private @Nullable BlockNodecalcSwitchOut(BlockNode block, SwitchInsn insn, RegionStack stack) static booleancanAppendBreak(IRegion region) private booleancanRemove(IContainer container, BlockNode outBlock) private @Nullable BlockNodegetOneIntersectionBlock(BlockNode out, BitSet caseBlocks, BitSet fallThroughSet) static voidinsertBreaks(MethodNode mth, SwitchRegion sw) Insert 'break' for all cases in switch region Executed inPostProcessRegionsafter try/catch wrap to handle all blocksprivate static voidinsertBreaksForCase(MethodNode mth, SwitchRegion switchRegion, IContainer caseContainer) Add break to every exit edge from 'case' region.private booleaninsertContinueInSwitch(BlockNode switchBlock, BlockNode switchOut, BlockNode loopEnd) private boolean(package private) BlockNodeprocess(IRegion currentRegion, BlockNode block, SwitchInsn insn, RegionStack stack) private voidremoveEmptyCases(SwitchInsn insn, SwitchRegion sw, BlockNode defCase, BlockNode outBlock) Remove empty case blocks: 1.reOrderSwitchCases(Map<BlockNode, List<Object>> blocksMap, Map<BlockNode, BlockNode> fallThroughCases)
-
Field Details
-
mth
-
regionMaker
-
LOG
private static final org.slf4j.Logger LOG
-
-
Constructor Details
-
SwitchRegionMaker
SwitchRegionMaker(MethodNode mth, RegionMaker regionMaker)
-
-
Method Details
-
process
-
insertBreaks
Insert 'break' for all cases in switch region Executed inPostProcessRegionsafter try/catch wrap to handle all blocks -
addCases
private void addCases(SwitchRegion sw, @Nullable @Nullable BlockNode out, RegionStack stack, Map<BlockNode, List<Object>> blocksMap) -
getOneIntersectionBlock
-
calcSwitchOut
@Nullable private @Nullable BlockNode calcSwitchOut(BlockNode block, SwitchInsn insn, RegionStack stack) -
allSameReturns
-
removeEmptyCases
private void removeEmptyCases(SwitchInsn insn, SwitchRegion sw, BlockNode defCase, BlockNode outBlock) Remove empty case blocks: 1. single 'default' case 2. filler cases if switch is 'packed' and 'default' case is empty -
canRemove
-
isBadCasesOrder
-
reOrderSwitchCases
-
insertContinueInSwitch
-
insertBreaksForCase
private static void insertBreaksForCase(MethodNode mth, SwitchRegion switchRegion, IContainer caseContainer) Add break to every exit edge from 'case' region. 'Break' optimizations (code duplication, unreachable, etc.) will be done atSwitchBreakVisitor -
canAppendBreak
-
buildBreakContainer
-