Class AstBuilder
java.lang.Object
com.strobel.decompiler.ast.AstBuilder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static final classprivate static final classprivate static final classprivate static final classprivate static final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MethodBodyprivate ControlFlowGraphprivate DecompilerContextprivate List<ExceptionHandler> private CoreMetadataFactoryprivate InstructionCollectionprivate final Map<ExceptionHandler, AstBuilder.ByteCode> private booleanprivate Map<Instruction, Instruction> private final Set<Instruction> private static final AstCode[]private static final AstBuilder.ByteCode[]private static final AstBuilder.StackSlot[]private static final Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidbuild(MethodBody body, boolean optimize, DecompilerContext context) private booleancallsOtherSubroutine(AstBuilder.SubroutineInfo subroutine, List<AstBuilder.SubroutineInfo> subroutines) private voidprivate voidconvertLocalVariables(AstBuilder.ByteCode[] parameterDefinitions, List<AstBuilder.ByteCode> body) convertToAst(List<AstBuilder.ByteCode> body) convertToAst(List<AstBuilder.ByteCode> body, Set<ExceptionHandler> exceptionHandlers, int startIndex, MutableInteger endIndex) private static InstructionCollectioncopyInstructions(List<Instruction> instructions) private static FramecreateFrame(AstBuilder.StackSlot[] stack, AstBuilder.VariableSlot[] locals) private static AstBuilder.StackSlot[]createModifiedStack(AstBuilder.ByteCode byteCode, StackMappingVisitor stackMapper) private static Map<Instruction, ControlFlowNode> private voidduplicateHandlersForInlinedSubroutine(AstBuilder.SubroutineInfo subroutine, Map<Instruction, Instruction> oldToNew) private voidprivate static Set<ControlFlowNode> findDominatedNodes(ControlFlowGraph cfg, ControlFlowNode head, boolean diveIntoHandlers, Set<ControlFlowNode> terminals) private static List<ExceptionHandler> findDuplicateHandlers(ExceptionHandler handler, Collection<ExceptionHandler> handlers) private static ExceptionHandlerfindFirstHandler(InstructionBlock tryBlock, Collection<ExceptionHandler> handlers) private static ControlFlowNodefindHandlerNode(ControlFlowGraph cfg, ExceptionHandler handler) private static List<ExceptionHandler> findHandlers(InstructionBlock tryBlock, Collection<ExceptionHandler> handlers) private ExceptionHandlerfindInnermostExceptionHandler(int offsetInTryBlock, ExceptionHandler exclude) private static ControlFlowNodefindInnermostExceptionHandlerNode(ControlFlowGraph cfg, int offsetInTryBlock, boolean finallyOnly) private static ControlFlowNodefindNode(ControlFlowGraph cfg, Instruction instruction) private List<AstBuilder.SubroutineInfo> private JvmTypegetStackType(TypeReference type) private booleaninlineSubroutine(AstBuilder.SubroutineInfo subroutine, Instruction reference) private voidprivate static booleanprivate static Stringkey(VariableDefinition variable) private static Map<String, VariableDefinition> makeVariableLookup(VariableDefinitionCollection variables) private static InstructionmappedInstruction(Map<Instruction, Instruction> map, Instruction instruction) private voidprivate TypeReferenceprivate booleanprivate static booleanopCodesMatch(Instruction tail1, Instruction tail2, int count, Function<Instruction, Instruction> previous) private List<AstBuilder.ByteCode> private List<AstBuilder.VariableInfo> processVariableUnoptimized(MethodDefinition method, int slot, List<AstBuilder.ByteCode> definitions, List<AstBuilder.ByteCode> references, VariableDefinition vDef) private voidprivate static List<ExceptionHandler> remapHandlers(List<ExceptionHandler> handlers, InstructionCollection instructions) private voidremapHandlersForInlinedSubroutine(Instruction jump, Instruction start, Instruction end) private voidremapJumps(Map<Instruction, Instruction> remappedJumps) private voidprivate voidprivate voidprivate voidprivate static booleanshouldIncludeExceptionalExit(ControlFlowGraph cfg, ControlFlowNode head, ControlFlowNode node) private voidprivate voidprivate voidupdateExceptionVariable(CatchBlock catchBlock, ExceptionHandler handler) private boolean
-
Field Details
-
LOG
-
CODES
-
EMPTY_STACK
-
EMPTY_DEFINITIONS
-
_loadExceptions
-
_removed
-
_originalInstructionMap
-
_cfg
-
_instructions
-
_exceptionHandlers
-
_body
-
_optimize
private boolean _optimize -
_context
-
_factory
-
NOT_A_LABEL_OR_NOP
-
-
Constructor Details
-
AstBuilder
public AstBuilder()
-
-
Method Details
-
build
-
isGetClassInvocation
-
removeGetClassCallsForInvokeDynamic
private void removeGetClassCallsForInvokeDynamic() -
inlineSubroutines
private void inlineSubroutines() -
inlineSubroutine
-
remapHandlersForInlinedSubroutine
private void remapHandlersForInlinedSubroutine(Instruction jump, Instruction start, Instruction end) -
duplicateHandlersForInlinedSubroutine
private void duplicateHandlersForInlinedSubroutine(AstBuilder.SubroutineInfo subroutine, Map<Instruction, Instruction> oldToNew) -
remapJumps
-
callsOtherSubroutine
private boolean callsOtherSubroutine(AstBuilder.SubroutineInfo subroutine, List<AstBuilder.SubroutineInfo> subroutines) -
findSubroutines
-
findNode
-
findDominatedNodes
private static Set<ControlFlowNode> findDominatedNodes(ControlFlowGraph cfg, ControlFlowNode head, boolean diveIntoHandlers, Set<ControlFlowNode> terminals) -
shouldIncludeExceptionalExit
private static boolean shouldIncludeExceptionalExit(ControlFlowGraph cfg, ControlFlowNode head, ControlFlowNode node) -
findInnermostExceptionHandlerNode
private static ControlFlowNode findInnermostExceptionHandlerNode(ControlFlowGraph cfg, int offsetInTryBlock, boolean finallyOnly) -
opCodesMatch
private static boolean opCodesMatch(Instruction tail1, Instruction tail2, int count, Function<Instruction, Instruction> previous) -
createNodeMap
-
remapHandlers
private static List<ExceptionHandler> remapHandlers(List<ExceptionHandler> handlers, InstructionCollection instructions) -
copyInstructions
-
pruneExceptionHandlers
private void pruneExceptionHandlers() -
removeEmptyCatchBlockBodies
private void removeEmptyCatchBlockBodies() -
ensureDesiredProtectedRanges
private void ensureDesiredProtectedRanges() -
alignFinallyBlocksWithSiblingCatchBlocks
private void alignFinallyBlocksWithSiblingCatchBlocks() -
trimAggressiveCatchBlocks
private void trimAggressiveCatchBlocks() -
removeSelfHandlingFinallyHandlers
private void removeSelfHandlingFinallyHandlers() -
trimAggressiveFinallyBlocks
private void trimAggressiveFinallyBlocks() -
findHandlerNode
-
findInnermostExceptionHandler
private ExceptionHandler findInnermostExceptionHandler(int offsetInTryBlock, ExceptionHandler exclude) -
closeTryHandlerGaps
private void closeTryHandlerGaps() -
removeTryIntersectionsWithPreviousCatch
private void removeTryIntersectionsWithPreviousCatch() -
findFirstHandler
private static ExceptionHandler findFirstHandler(InstructionBlock tryBlock, Collection<ExceptionHandler> handlers) -
findHandlers
private static List<ExceptionHandler> findHandlers(InstructionBlock tryBlock, Collection<ExceptionHandler> handlers) -
findDuplicateHandlers
private static List<ExceptionHandler> findDuplicateHandlers(ExceptionHandler handler, Collection<ExceptionHandler> handlers) -
performStackAnalysis
-
mappedInstruction
private static Instruction mappedInstruction(Map<Instruction, Instruction> map, Instruction instruction) -
createModifiedStack
private static AstBuilder.StackSlot[] createModifiedStack(AstBuilder.ByteCode byteCode, StackMappingVisitor stackMapper) -
convertLocalVariables
private void convertLocalVariables(AstBuilder.ByteCode[] parameterDefinitions, List<AstBuilder.ByteCode> body) -
processVariableUnoptimized
private List<AstBuilder.VariableInfo> processVariableUnoptimized(MethodDefinition method, int slot, List<AstBuilder.ByteCode> definitions, List<AstBuilder.ByteCode> references, VariableDefinition vDef) -
mightBeBoolean
-
mergeVariableType
-
getStackType
-
variablesMatch
-
makeVariableLookup
private static Map<String, VariableDefinition> makeVariableLookup(VariableDefinitionCollection variables) -
key
-
convertToAst
private List<Node> convertToAst(List<AstBuilder.ByteCode> body, Set<ExceptionHandler> exceptionHandlers, int startIndex, MutableInteger endIndex) -
updateExceptionVariable
-
convertToAst
-
createFrame
-