Class Op04StructuredStatement
java.lang.Object
org.benf.cfr.reader.bytecode.analysis.opgraph.Op04StructuredStatement
- All Implemented Interfaces:
Graph<Op04StructuredStatement>
,MutableGraph<Op04StructuredStatement>
,StatementContainer<StructuredStatement>
,Dumpable
,TypeUsageCollectable
public class Op04StructuredStatement
extends Object
implements MutableGraph<Op04StructuredStatement>, Dumpable, StatementContainer<StructuredStatement>, TypeUsageCollectable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Set<BlockIdentifier>
private static final Set<BlockIdentifier>
private InstrIndex
private static final Logger
private List<Op04StructuredStatement>
private StructuredStatement
private List<Op04StructuredStatement>
-
Constructor Summary
ConstructorsConstructorDescriptionOp04StructuredStatement
(InstrIndex instrIndex, Collection<BlockIdentifier> blockMembership, StructuredStatement structuredStatement) Op04StructuredStatement
(StructuredStatement justStatement) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSource
(Op04StructuredStatement source) void
addTarget
(Op04StructuredStatement target) static void
applyChecker
(Op04Checker checker, Op04StructuredStatement root, DecompilerComments comments) private static void
applyLValueReplacer
(Map<LValue, LValue> replacements, Op04StructuredStatement root) static void
applyTypeAnnotations
(AttributeCode code, Op04StructuredStatement root, SortedMap<Integer, Integer> instrsByOffset, DecompilerComments comments) private static Set<BlockIdentifier>
(package private) static Op04StructuredStatement
buildNestedBlocks
(List<Op04StructuredStatement> containers) static boolean
checkTypeClashes
(Op04StructuredStatement block, BytecodeMeta bytecodeMeta) private boolean
claimBlock
(Op04StructuredStatement innerBlock, BlockIdentifier thisBlock, Vector<BlockIdentifier> currentlyIn) void
collectTypeUsages
(TypeUsageCollector collector) static void
void
void
static void
discoverLocalClassScopes
(Method method, Op04StructuredStatement root, VariableFactory variableFactory, Options options) static void
discoverVariableScopes
(Method method, Op04StructuredStatement root, VariableFactory variableFactory, Options options, ClassFileVersion classFileVersion, BytecodeMeta bytecodeMeta) static FieldVariable
findInnerClassOuterThis
(Method method, Op04StructuredStatement root) static void
fixInnerClassConstructorSyntheticOuterArgs
(ClassFile classFile, Method method, Op04StructuredStatement root, Set<MethodPrototype> processed) static void
private static Set<BlockIdentifier>
getEndingBlocks
(Stack<BlockIdentifier> wasIn, Set<BlockIdentifier> nowIn) getIndex()
private static String
getInnerClassOuterArgName
(Method method, LValue lValueArg) getLabel()
private static BlockIdentifier
getStartingBlocks
(Stack<BlockIdentifier> wasIn, Set<BlockIdentifier> nowIn) getTargetLabel
(int idx) getTargetStatement
(int idx) private boolean
private static void
hideField
(Op04StructuredStatement root, MethodPrototype prototype, ClassFile classFile, int x, LocalVariable protoVar, LValue lValueArg, String overrideName) void
informBlockMembership
(Vector<BlockIdentifier> currentlyIn) static void
static void
inlineSyntheticAccessors
(DCCommonState state, Method method, Op04StructuredStatement root) static void
boolean
boolean
static boolean
void
static void
miscKeyholeTransforms
(VariableFactory variableFactory, Op04StructuredStatement root) void
nopOut()
void
static void
normalizeInstanceOf
(Op04StructuredStatement root, Options options, ClassFileVersion classFileVersion) static void
private static void
processEndingBlocks
(Set<BlockIdentifier> endOfTheseBlocks, Stack<BlockIdentifier> blocksCurrentlyIn, Stack<Op04StructuredStatement.StackedBlock> stackedBlocks, Op04StructuredStatement.MutableProcessingBlockState mutableProcessingBlockState) static void
reduceClashDeclarations
(Op04StructuredStatement root, BytecodeMeta bytecodeMeta) private static void
removeAnonymousSyntheticConstructorOuterArgs
(Method method, Op04StructuredStatement root, boolean isInstance) static void
static void
removeEndResource
(ClassFile classFile, Op04StructuredStatement root) static void
removeInnerClassOuterThis
(Method method, Op04StructuredStatement root) void
void
private static void
removeMethodScopedSyntheticConstructorOuterArgs
(Method method, Op04StructuredStatement root, Set<MethodPrototype> processed) static void
static void
static void
static void
removePrimitiveDeconversion
(Options options, Method method, Op04StructuredStatement root) static void
static void
static void
removeUnnecessaryVarargArrays
(Options options, Method method, Op04StructuredStatement root) private void
static void
replaceInSources
(Op04StructuredStatement original, Op04StructuredStatement replacement) static void
replaceInTargets
(Op04StructuredStatement original, Op04StructuredStatement replacement) static void
void
void
replaceStatement
(StructuredStatement newTarget) void
replaceStatementWithNOP
(String comment) void
static void
rewriteBadCastChains
(Options options, Method method, Op04StructuredStatement root) static void
rewriteExplicitTypeUsages
(Method method, Op04StructuredStatement block, AnonymousClassUsage anonymousClassUsage, ClassFile classFile) static void
rewriteLambdas
(DCCommonState state, Method method, Op04StructuredStatement root) static void
rewriteNarrowingAssignments
(Options options, Method method, Op04StructuredStatement root) void
setSources
(List<Op04StructuredStatement> sources) void
setTargets
(List<Op04StructuredStatement> targets) static void
switchExpression
(Method method, Op04StructuredStatement root, DecompilerComments comments) static void
static void
static void
static void
tidyObfuscation
(Options options, Op04StructuredStatement root) static void
static void
static void
tidyVariableNames
(Method method, Op04StructuredStatement root, BytecodeMeta bytecodeMeta, DecompilerComments comments, ClassCache classCache) toString()
void
transform
(StructuredStatementTransformer transformer, StructuredScope scope) private static StructuredStatement
transformStructuredGotoWithScope
(StructuredScope scope, StructuredStatement stm, Stack<Triplet<StructuredStatement, BlockIdentifier, Set<Op04StructuredStatement>>> breaktargets)
-
Field Details
-
logger
-
instrIndex
-
sources
-
targets
-
structuredStatement
-
blockMembership
-
EMPTY_BLOCKSET
-
-
Constructor Details
-
Op04StructuredStatement
-
Op04StructuredStatement
public Op04StructuredStatement(InstrIndex instrIndex, Collection<BlockIdentifier> blockMembership, StructuredStatement structuredStatement)
-
-
Method Details
-
blockSet
-
rewriteExplicitTypeUsages
public static void rewriteExplicitTypeUsages(Method method, Op04StructuredStatement block, AnonymousClassUsage anonymousClassUsage, ClassFile classFile) -
flattenNonReferencedBlocks
-
switchExpression
public static void switchExpression(Method method, Op04StructuredStatement root, DecompilerComments comments) -
reduceClashDeclarations
-
normalizeInstanceOf
public static void normalizeInstanceOf(Op04StructuredStatement root, Options options, ClassFileVersion classFileVersion) -
nopThisAndReplace
-
nopOut
public void nopOut()- Specified by:
nopOut
in interfaceStatementContainer<StructuredStatement>
-
getStatement
- Specified by:
getStatement
in interfaceStatementContainer<StructuredStatement>
-
collectTypeUsages
- Specified by:
collectTypeUsages
in interfaceTypeUsageCollectable
-
getTargetStatement
- Specified by:
getTargetStatement
in interfaceStatementContainer<StructuredStatement>
-
getLabel
- Specified by:
getLabel
in interfaceStatementContainer<StructuredStatement>
-
getIndex
- Specified by:
getIndex
in interfaceStatementContainer<StructuredStatement>
-
replaceStatement
- Specified by:
replaceStatement
in interfaceStatementContainer<StructuredStatement>
-
nopOutConditional
public void nopOutConditional()- Specified by:
nopOutConditional
in interfaceStatementContainer<StructuredStatement>
-
getSSAIdentifiers
- Specified by:
getSSAIdentifiers
in interfaceStatementContainer<StructuredStatement>
-
getBlockIdentifiers
- Specified by:
getBlockIdentifiers
in interfaceStatementContainer<StructuredStatement>
-
getBlockStarted
- Specified by:
getBlockStarted
in interfaceStatementContainer<StructuredStatement>
-
getBlocksEnded
- Specified by:
getBlocksEnded
in interfaceStatementContainer<StructuredStatement>
-
copyBlockInformationFrom
- Specified by:
copyBlockInformationFrom
in interfaceStatementContainer<StructuredStatement>
-
copyBytecodeInformationFrom
- Specified by:
copyBytecodeInformationFrom
in interfaceStatementContainer<StructuredStatement>
-
hasUnstructuredSource
private boolean hasUnstructuredSource() -
getBlockMembership
-
dump
-
getSources
- Specified by:
getSources
in interfaceGraph<Op04StructuredStatement>
-
getTargets
- Specified by:
getTargets
in interfaceGraph<Op04StructuredStatement>
-
addSource
- Specified by:
addSource
in interfaceMutableGraph<Op04StructuredStatement>
-
addTarget
- Specified by:
addTarget
in interfaceMutableGraph<Op04StructuredStatement>
-
getTargetLabel
-
isEmptyInitialiser
public boolean isEmptyInitialiser() -
replaceAsSource
-
replaceTarget
-
replaceSource
-
setSources
-
setTargets
-
replaceInSources
public static void replaceInSources(Op04StructuredStatement original, Op04StructuredStatement replacement) -
replaceInTargets
public static void replaceInTargets(Op04StructuredStatement original, Op04StructuredStatement replacement) -
linearizeStatementsInto
-
removeLastContinue
-
removeLastGoto
public void removeLastGoto() -
removeLastEndWhile
-
informBlockMembership
-
toString
-
replaceStatementWithNOP
-
claimBlock
private boolean claimBlock(Op04StructuredStatement innerBlock, BlockIdentifier thisBlock, Vector<BlockIdentifier> currentlyIn) -
getEndingBlocks
private static Set<BlockIdentifier> getEndingBlocks(Stack<BlockIdentifier> wasIn, Set<BlockIdentifier> nowIn) -
getStartingBlocks
private static BlockIdentifier getStartingBlocks(Stack<BlockIdentifier> wasIn, Set<BlockIdentifier> nowIn) -
processEndingBlocks
private static void processEndingBlocks(Set<BlockIdentifier> endOfTheseBlocks, Stack<BlockIdentifier> blocksCurrentlyIn, Stack<Op04StructuredStatement.StackedBlock> stackedBlocks, Op04StructuredStatement.MutableProcessingBlockState mutableProcessingBlockState) -
isFullyStructured
public boolean isFullyStructured() -
buildNestedBlocks
-
transformStructuredGotoWithScope
private static StructuredStatement transformStructuredGotoWithScope(StructuredScope scope, StructuredStatement stm, Stack<Triplet<StructuredStatement, BlockIdentifier, Set<Op04StructuredStatement>>> breaktargets) -
transform
-
insertLabelledBlocks
-
tidyEmptyCatch
-
tidyTryCatch
-
inlinePossibles
-
convertUnstructuredIf
-
tidyVariableNames
public static void tidyVariableNames(Method method, Op04StructuredStatement root, BytecodeMeta bytecodeMeta, DecompilerComments comments, ClassCache classCache) -
applyTypeAnnotations
public static void applyTypeAnnotations(AttributeCode code, Op04StructuredStatement root, SortedMap<Integer, Integer> instrsByOffset, DecompilerComments comments) -
removePointlessReturn
-
removeEndResource
-
removePointlessControlFlow
-
tidyTypedBooleans
-
miscKeyholeTransforms
public static void miscKeyholeTransforms(VariableFactory variableFactory, Op04StructuredStatement root) -
tidyObfuscation
-
prettifyBadLoops
-
removeStructuredGotos
-
removeUnnecessaryLabelledBreaks
-
removePointlessBlocks
-
discoverVariableScopes
public static void discoverVariableScopes(Method method, Op04StructuredStatement root, VariableFactory variableFactory, Options options, ClassFileVersion classFileVersion, BytecodeMeta bytecodeMeta) -
discoverLocalClassScopes
public static void discoverLocalClassScopes(Method method, Op04StructuredStatement root, VariableFactory variableFactory, Options options) -
tidyInstanceMatches
-
checkTypeClashes
-
findInnerClassOuterThis
-
removeInnerClassOuterThis
-
removeMethodScopedSyntheticConstructorOuterArgs
private static void removeMethodScopedSyntheticConstructorOuterArgs(Method method, Op04StructuredStatement root, Set<MethodPrototype> processed) -
removeAnonymousSyntheticConstructorOuterArgs
private static void removeAnonymousSyntheticConstructorOuterArgs(Method method, Op04StructuredStatement root, boolean isInstance) -
getInnerClassOuterArgName
-
hideField
private static void hideField(Op04StructuredStatement root, MethodPrototype prototype, ClassFile classFile, int x, LocalVariable protoVar, LValue lValueArg, String overrideName) -
applyLValueReplacer
private static void applyLValueReplacer(Map<LValue, LValue> replacements, Op04StructuredStatement root) -
fixInnerClassConstructorSyntheticOuterArgs
public static void fixInnerClassConstructorSyntheticOuterArgs(ClassFile classFile, Method method, Op04StructuredStatement root, Set<MethodPrototype> processed) -
tidyAnonymousConstructors
-
inlineSyntheticAccessors
public static void inlineSyntheticAccessors(DCCommonState state, Method method, Op04StructuredStatement root) -
removeConstructorBoilerplate
-
rewriteLambdas
-
removeUnnecessaryVarargArrays
public static void removeUnnecessaryVarargArrays(Options options, Method method, Op04StructuredStatement root) -
removePrimitiveDeconversion
public static void removePrimitiveDeconversion(Options options, Method method, Op04StructuredStatement root) -
rewriteBadCastChains
public static void rewriteBadCastChains(Options options, Method method, Op04StructuredStatement root) -
rewriteNarrowingAssignments
public static void rewriteNarrowingAssignments(Options options, Method method, Op04StructuredStatement root) -
replaceNestedSyntheticOuterRefs
-
applyChecker
public static void applyChecker(Op04Checker checker, Op04StructuredStatement root, DecompilerComments comments) -
isTryWithResourceSynthetic
-