Class SwitchReplacer
java.lang.Object
org.benf.cfr.reader.bytecode.analysis.opgraph.op3rewriters.SwitchReplacer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
blockIsContiguous
(List<Op03SimpleStatement> in, Op03SimpleStatement start, Set<Op03SimpleStatement> blockContent) private static void
buildSwitchCases
(Op03SimpleStatement swatch, List<Op03SimpleStatement> targets, BlockIdentifier switchBlockIdentifier, List<Op03SimpleStatement> in, boolean forcedOrder) private static int
checkPreSwitchJump
(List<Op03SimpleStatement> statements, Op03SimpleStatement switchStm, int idxLastStart, int idxLastEnd) private static Op03SimpleStatement
examineSwitchContiguity
(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements, boolean pullCodeIntoCase, boolean allowMalformedSwitch, DecompilerComments comments, BytecodeMeta bytecodeMeta) private static int
getDefault
(DecodedSwitch decodedSwitch) private static void
moveInternalJumpsToTerminal
(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements, Op03SimpleStatement lastTgt, Op03SimpleStatement following, List<Op03SimpleStatement> forwardJumpSources) private static void
moveJumpsToCaseStatements
(Op03SimpleStatement switchStatement) private static void
moveJumpsToTerminalIfEmpty
(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements) private static Op03SimpleStatement
moveSwitch
(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements, Op03SimpleStatement firstCase, int idxFirstCase, List<Op03SimpleStatement> targets) static void
rebuildSwitches
(List<Op03SimpleStatement> statements, Options options, DecompilerComments comments, BytecodeMeta bytecodeMeta) private static Op03SimpleStatement
replaceRawSwitch
(Method method, Op03SimpleStatement swatch, List<Op03SimpleStatement> in, BlockIdentifierFactory blockIdentifierFactory, Options options) static void
replaceRawSwitches
(Method method, List<Op03SimpleStatement> in, BlockIdentifierFactory blockIdentifierFactory, Options options, DecompilerComments comments, BytecodeMeta bytecodeMeta) static List<Op03SimpleStatement>
rewriteDuff
(List<Op03SimpleStatement> statements, VariableFactory vf, DecompilerComments decompilerComments, Options options) private static boolean
rewriteDuff
(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements, VariableFactory vf, DecompilerComments decompilerComments) private static void
tightenJumpsToTerminal
(List<Op03SimpleStatement> statements, BlockIdentifier switchBlock, Op03SimpleStatement following, Op03SimpleStatement followingTrans) private static void
tryInlineRawSwitchContent
(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements)
-
Constructor Details
-
SwitchReplacer
public SwitchReplacer()
-
-
Method Details
-
replaceRawSwitches
public static void replaceRawSwitches(Method method, List<Op03SimpleStatement> in, BlockIdentifierFactory blockIdentifierFactory, Options options, DecompilerComments comments, BytecodeMeta bytecodeMeta) -
rewriteDuff
public static List<Op03SimpleStatement> rewriteDuff(List<Op03SimpleStatement> statements, VariableFactory vf, DecompilerComments decompilerComments, Options options) -
replaceRawSwitch
private static Op03SimpleStatement replaceRawSwitch(Method method, Op03SimpleStatement swatch, List<Op03SimpleStatement> in, BlockIdentifierFactory blockIdentifierFactory, Options options) -
buildSwitchCases
private static void buildSwitchCases(Op03SimpleStatement swatch, List<Op03SimpleStatement> targets, BlockIdentifier switchBlockIdentifier, List<Op03SimpleStatement> in, boolean forcedOrder) -
rebuildSwitches
public static void rebuildSwitches(List<Op03SimpleStatement> statements, Options options, DecompilerComments comments, BytecodeMeta bytecodeMeta) -
blockIsContiguous
private static boolean blockIsContiguous(List<Op03SimpleStatement> in, Op03SimpleStatement start, Set<Op03SimpleStatement> blockContent) -
examineSwitchContiguity
private static Op03SimpleStatement examineSwitchContiguity(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements, boolean pullCodeIntoCase, boolean allowMalformedSwitch, DecompilerComments comments, BytecodeMeta bytecodeMeta) -
checkPreSwitchJump
private static int checkPreSwitchJump(List<Op03SimpleStatement> statements, Op03SimpleStatement switchStm, int idxLastStart, int idxLastEnd) -
moveSwitch
private static Op03SimpleStatement moveSwitch(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements, Op03SimpleStatement firstCase, int idxFirstCase, List<Op03SimpleStatement> targets) -
moveJumpsToCaseStatements
-
moveJumpsToTerminalIfEmpty
private static void moveJumpsToTerminalIfEmpty(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements) -
tightenJumpsToTerminal
private static void tightenJumpsToTerminal(List<Op03SimpleStatement> statements, BlockIdentifier switchBlock, Op03SimpleStatement following, Op03SimpleStatement followingTrans) -
moveInternalJumpsToTerminal
private static void moveInternalJumpsToTerminal(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements, Op03SimpleStatement lastTgt, Op03SimpleStatement following, List<Op03SimpleStatement> forwardJumpSources) -
getDefault
-
tryInlineRawSwitchContent
private static void tryInlineRawSwitchContent(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements) -
rewriteDuff
private static boolean rewriteDuff(Op03SimpleStatement switchStatement, List<Op03SimpleStatement> statements, VariableFactory vf, DecompilerComments decompilerComments)
-