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