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 java.lang.Object implements MutableGraph<Op04StructuredStatement>, Dumpable, StatementContainer<StructuredStatement>, TypeUsageCollectable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Op04StructuredStatement.EmptyCatchTidier
private static class
Op04StructuredStatement.Inliner
private static class
Op04StructuredStatement.LabelledBlockExtractor
private static class
Op04StructuredStatement.MutableProcessingBlockState
private static class
Op04StructuredStatement.NamedBreakRemover
private static class
Op04StructuredStatement.PointlessBlockRemover
private static class
Op04StructuredStatement.ScopeDescendingTransformer
private static class
Op04StructuredStatement.StackedBlock
private static class
Op04StructuredStatement.StructuredGotoRemover
private static class
Op04StructuredStatement.TryCatchTidier
static class
Op04StructuredStatement.UnstructuredIfConverter
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<BlockIdentifier>
blockMembership
private static java.util.Set<BlockIdentifier>
EMPTY_BLOCKSET
private InstrIndex
instrIndex
private static java.util.logging.Logger
logger
private java.util.List<Op04StructuredStatement>
sources
private StructuredStatement
structuredStatement
private java.util.List<Op04StructuredStatement>
targets
-
Constructor Summary
Constructors Constructor Description Op04StructuredStatement(InstrIndex instrIndex, java.util.Collection<BlockIdentifier> blockMembership, StructuredStatement structuredStatement)
Op04StructuredStatement(StructuredStatement justStatement)
-
Method Summary
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
instrIndex
private InstrIndex instrIndex
-
sources
private java.util.List<Op04StructuredStatement> sources
-
targets
private java.util.List<Op04StructuredStatement> targets
-
structuredStatement
private StructuredStatement structuredStatement
-
blockMembership
private java.util.Set<BlockIdentifier> blockMembership
-
EMPTY_BLOCKSET
private static final java.util.Set<BlockIdentifier> EMPTY_BLOCKSET
-
-
Constructor Detail
-
Op04StructuredStatement
public Op04StructuredStatement(StructuredStatement justStatement)
-
Op04StructuredStatement
public Op04StructuredStatement(InstrIndex instrIndex, java.util.Collection<BlockIdentifier> blockMembership, StructuredStatement structuredStatement)
-
-
Method Detail
-
blockSet
private static java.util.Set<BlockIdentifier> blockSet(java.util.Collection<BlockIdentifier> in)
-
rewriteExplicitTypeUsages
public static void rewriteExplicitTypeUsages(Method method, Op04StructuredStatement block, AnonymousClassUsage anonymousClassUsage, ClassFile classFile)
-
flattenNonReferencedBlocks
public static void flattenNonReferencedBlocks(Op04StructuredStatement block)
-
switchExpression
public static void switchExpression(Method method, Op04StructuredStatement root, DecompilerComments comments)
-
reduceClashDeclarations
public static void reduceClashDeclarations(Op04StructuredStatement root, BytecodeMeta bytecodeMeta)
-
normalizeInstanceOf
public static void normalizeInstanceOf(Op04StructuredStatement root, Options options, ClassFileVersion classFileVersion)
-
nopThisAndReplace
public Op04StructuredStatement nopThisAndReplace()
-
nopOut
public void nopOut()
- Specified by:
nopOut
in interfaceStatementContainer<StructuredStatement>
-
getStatement
public StructuredStatement getStatement()
- Specified by:
getStatement
in interfaceStatementContainer<StructuredStatement>
-
collectTypeUsages
public void collectTypeUsages(TypeUsageCollector collector)
- Specified by:
collectTypeUsages
in interfaceTypeUsageCollectable
-
getTargetStatement
public StructuredStatement getTargetStatement(int idx)
- Specified by:
getTargetStatement
in interfaceStatementContainer<StructuredStatement>
-
getLabel
public java.lang.String getLabel()
- Specified by:
getLabel
in interfaceStatementContainer<StructuredStatement>
-
getIndex
public InstrIndex getIndex()
- Specified by:
getIndex
in interfaceStatementContainer<StructuredStatement>
-
replaceStatement
public void replaceStatement(StructuredStatement newTarget)
- Specified by:
replaceStatement
in interfaceStatementContainer<StructuredStatement>
-
nopOutConditional
public void nopOutConditional()
- Specified by:
nopOutConditional
in interfaceStatementContainer<StructuredStatement>
-
getSSAIdentifiers
public SSAIdentifiers<LValue> getSSAIdentifiers()
- Specified by:
getSSAIdentifiers
in interfaceStatementContainer<StructuredStatement>
-
getBlockIdentifiers
public java.util.Set<BlockIdentifier> getBlockIdentifiers()
- Specified by:
getBlockIdentifiers
in interfaceStatementContainer<StructuredStatement>
-
getBlockStarted
public BlockIdentifier getBlockStarted()
- Specified by:
getBlockStarted
in interfaceStatementContainer<StructuredStatement>
-
getBlocksEnded
public java.util.Set<BlockIdentifier> getBlocksEnded()
- Specified by:
getBlocksEnded
in interfaceStatementContainer<StructuredStatement>
-
copyBlockInformationFrom
public void copyBlockInformationFrom(StatementContainer<StructuredStatement> other)
- Specified by:
copyBlockInformationFrom
in interfaceStatementContainer<StructuredStatement>
-
copyBytecodeInformationFrom
public void copyBytecodeInformationFrom(StatementContainer<StructuredStatement> other)
- Specified by:
copyBytecodeInformationFrom
in interfaceStatementContainer<StructuredStatement>
-
hasUnstructuredSource
private boolean hasUnstructuredSource()
-
getBlockMembership
public java.util.Collection<BlockIdentifier> getBlockMembership()
-
getSources
public java.util.List<Op04StructuredStatement> getSources()
- Specified by:
getSources
in interfaceGraph<Op04StructuredStatement>
-
getTargets
public java.util.List<Op04StructuredStatement> getTargets()
- Specified by:
getTargets
in interfaceGraph<Op04StructuredStatement>
-
addSource
public void addSource(Op04StructuredStatement source)
- Specified by:
addSource
in interfaceMutableGraph<Op04StructuredStatement>
-
addTarget
public void addTarget(Op04StructuredStatement target)
- Specified by:
addTarget
in interfaceMutableGraph<Op04StructuredStatement>
-
getTargetLabel
public java.lang.String getTargetLabel(int idx)
-
isEmptyInitialiser
public boolean isEmptyInitialiser()
-
replaceAsSource
private void replaceAsSource(Op04StructuredStatement old)
-
replaceTarget
public void replaceTarget(Op04StructuredStatement from, Op04StructuredStatement to)
-
replaceSource
public void replaceSource(Op04StructuredStatement from, Op04StructuredStatement to)
-
setSources
public void setSources(java.util.List<Op04StructuredStatement> sources)
-
setTargets
public void setTargets(java.util.List<Op04StructuredStatement> targets)
-
replaceInSources
public static void replaceInSources(Op04StructuredStatement original, Op04StructuredStatement replacement)
-
replaceInTargets
public static void replaceInTargets(Op04StructuredStatement original, Op04StructuredStatement replacement)
-
linearizeStatementsInto
public void linearizeStatementsInto(java.util.List<StructuredStatement> out)
-
removeLastContinue
public void removeLastContinue(BlockIdentifier block)
-
removeLastGoto
public void removeLastGoto()
-
removeLastEndWhile
public UnstructuredWhile removeLastEndWhile()
-
informBlockMembership
public void informBlockMembership(java.util.Vector<BlockIdentifier> currentlyIn)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
replaceStatementWithNOP
public void replaceStatementWithNOP(java.lang.String comment)
-
claimBlock
private boolean claimBlock(Op04StructuredStatement innerBlock, BlockIdentifier thisBlock, java.util.Vector<BlockIdentifier> currentlyIn)
-
getEndingBlocks
private static java.util.Set<BlockIdentifier> getEndingBlocks(java.util.Stack<BlockIdentifier> wasIn, java.util.Set<BlockIdentifier> nowIn)
-
getStartingBlocks
private static BlockIdentifier getStartingBlocks(java.util.Stack<BlockIdentifier> wasIn, java.util.Set<BlockIdentifier> nowIn)
-
processEndingBlocks
private static void processEndingBlocks(java.util.Set<BlockIdentifier> endOfTheseBlocks, java.util.Stack<BlockIdentifier> blocksCurrentlyIn, java.util.Stack<Op04StructuredStatement.StackedBlock> stackedBlocks, Op04StructuredStatement.MutableProcessingBlockState mutableProcessingBlockState)
-
isFullyStructured
public boolean isFullyStructured()
-
buildNestedBlocks
static Op04StructuredStatement buildNestedBlocks(java.util.List<Op04StructuredStatement> containers)
-
transformStructuredGotoWithScope
private static StructuredStatement transformStructuredGotoWithScope(StructuredScope scope, StructuredStatement stm, java.util.Stack<Triplet<StructuredStatement,BlockIdentifier,java.util.Set<Op04StructuredStatement>>> breaktargets)
-
transform
public void transform(StructuredStatementTransformer transformer, StructuredScope scope)
-
insertLabelledBlocks
public static void insertLabelledBlocks(Op04StructuredStatement root)
-
tidyEmptyCatch
public static void tidyEmptyCatch(Op04StructuredStatement root)
-
tidyTryCatch
public static void tidyTryCatch(Op04StructuredStatement root)
-
inlinePossibles
public static void inlinePossibles(Op04StructuredStatement root)
-
convertUnstructuredIf
public static void convertUnstructuredIf(Op04StructuredStatement root)
-
tidyVariableNames
public static void tidyVariableNames(Method method, Op04StructuredStatement root, BytecodeMeta bytecodeMeta, DecompilerComments comments, ClassCache classCache)
-
applyTypeAnnotations
public static void applyTypeAnnotations(AttributeCode code, Op04StructuredStatement root, java.util.SortedMap<java.lang.Integer,java.lang.Integer> instrsByOffset, DecompilerComments comments)
-
removePointlessReturn
public static void removePointlessReturn(Op04StructuredStatement root)
-
removeEndResource
public static void removeEndResource(ClassFile classFile, Op04StructuredStatement root)
-
removePointlessControlFlow
public static void removePointlessControlFlow(Op04StructuredStatement root)
-
tidyTypedBooleans
public static void tidyTypedBooleans(Op04StructuredStatement root)
-
miscKeyholeTransforms
public static void miscKeyholeTransforms(VariableFactory variableFactory, Op04StructuredStatement root)
-
tidyObfuscation
public static void tidyObfuscation(Options options, Op04StructuredStatement root)
-
prettifyBadLoops
public static void prettifyBadLoops(Op04StructuredStatement root)
-
removeStructuredGotos
public static void removeStructuredGotos(Op04StructuredStatement root)
-
removeUnnecessaryLabelledBreaks
public static void removeUnnecessaryLabelledBreaks(Op04StructuredStatement root)
-
removePointlessBlocks
public static void removePointlessBlocks(Op04StructuredStatement root)
-
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
public static void tidyInstanceMatches(Op04StructuredStatement block)
-
checkTypeClashes
public static boolean checkTypeClashes(Op04StructuredStatement block, BytecodeMeta bytecodeMeta)
-
findInnerClassOuterThis
public static FieldVariable findInnerClassOuterThis(Method method, Op04StructuredStatement root)
-
removeInnerClassOuterThis
public static void removeInnerClassOuterThis(Method method, Op04StructuredStatement root)
-
removeMethodScopedSyntheticConstructorOuterArgs
private static void removeMethodScopedSyntheticConstructorOuterArgs(Method method, Op04StructuredStatement root, java.util.Set<MethodPrototype> processed)
-
removeAnonymousSyntheticConstructorOuterArgs
private static void removeAnonymousSyntheticConstructorOuterArgs(Method method, Op04StructuredStatement root, boolean isInstance)
-
getInnerClassOuterArgName
private static java.lang.String getInnerClassOuterArgName(Method method, LValue lValueArg)
-
hideField
private static void hideField(Op04StructuredStatement root, MethodPrototype prototype, ClassFile classFile, int x, LocalVariable protoVar, LValue lValueArg, java.lang.String overrideName)
-
applyLValueReplacer
private static void applyLValueReplacer(java.util.Map<LValue,LValue> replacements, Op04StructuredStatement root)
-
fixInnerClassConstructorSyntheticOuterArgs
public static void fixInnerClassConstructorSyntheticOuterArgs(ClassFile classFile, Method method, Op04StructuredStatement root, java.util.Set<MethodPrototype> processed)
-
tidyAnonymousConstructors
public static void tidyAnonymousConstructors(Op04StructuredStatement root)
-
inlineSyntheticAccessors
public static void inlineSyntheticAccessors(DCCommonState state, Method method, Op04StructuredStatement root)
-
removeConstructorBoilerplate
public static void removeConstructorBoilerplate(Op04StructuredStatement root)
-
rewriteLambdas
public static void rewriteLambdas(DCCommonState state, Method method, Op04StructuredStatement root)
-
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
public static void replaceNestedSyntheticOuterRefs(Op04StructuredStatement root)
-
applyChecker
public static void applyChecker(Op04Checker checker, Op04StructuredStatement root, DecompilerComments comments)
-
isTryWithResourceSynthetic
public static boolean isTryWithResourceSynthetic(Method m, Op04StructuredStatement root)
-
-