Package jadx.core.dex.visitors
Class ModVisitor
java.lang.Object
jadx.core.dex.visitors.AbstractVisitor
jadx.core.dex.visitors.ModVisitor
- All Implemented Interfaces:
IDexTreeVisitor
Visitor for modify method instructions
(remove, replace, process exception handlers)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longprivate static final longprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddFieldUsage(IFieldInfoRef fieldData, MethodNode mth) private static voidprivate static booleancheckArrSizes(MethodNode mth, NewArrayNode newArrInsn, FillArrayInsn fillArrInsn) private static voidfixFieldUsage(MethodNode mth, IndexInsnNode insn) If field is not visible from use site => cast to origin classprivate static voidfixPrimitiveCast(MethodNode mth, BlockNode block, int i, InsnNode insn) private static @Nullable InsnNodeReturn first usage instruction for arg.private static voidinlineCMPInsns(MethodNode mth, BlockNode block, int i, InsnNode insn, InsnRemover remover) Inline CMP instructions into 'if' to help conditions mergingprivate static @Nullable InsnNodeisCastDuplicate(IndexInsnNode castInsn) private static booleanisFieldVisibleInMethod(FieldNode field, MethodNode mth) private static booleanisResultArgNotUsed(InsnNode insn) private static voidstatic TernaryInsnmakeBooleanConvertInsn(RegisterArg result, InsnArg castArg, ArgType type) private static InsnNodemakeFilledArrayInsn(MethodNode mth, NewArrayNode newArrayNode, FillArrayInsn insn) private static voidFor args in anonymous constructor invoke apply: - forbid inline into constructor call - make variables final (compiler require this implicitly)private static voidprocessArith(MethodNode mth, ClassNode parentClass, ArithNode arithNode) private static voidprocessMoveException(MethodNode mth, BlockNode block, InsnNode insn, InsnRemover remover) private static voidremoveCheckCast(MethodNode mth, BlockNode block, int i, IndexInsnNode insn) private static voidremoveStep(MethodNode mth, InsnRemover remover) Remove unnecessary instructionsprivate static voidreplaceConst(MethodNode mth, ClassNode parentClass, BlockNode block, int i, InsnNode insn) private voidprivate static voidreplaceConstKeys(MethodNode mth, ClassNode parentClass, SwitchInsn insn) private voidreplaceConstsInAnnotationForAttrNode(ClassNode parentCls, AttrNode attrNode) private voidprivate voidreplaceConstsInAnnotationsAttr(ClassNode parentCls, AnnotationsAttr annotationsList) private EncodedValuereplaceConstValue(ClassNode parentCls, EncodedValue encodedValue) private static voidreplaceStep(MethodNode mth, InsnRemover remover) booleanVisit classvoidvisit(MethodNode mth) Visit methodMethods inherited from class jadx.core.dex.visitors.AbstractVisitor
getName, init, toString
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
DOUBLE_TO_BITS
private static final long DOUBLE_TO_BITS -
FLOAT_TO_BITS
private static final long FLOAT_TO_BITS
-
-
Constructor Details
-
ModVisitor
public ModVisitor()
-
-
Method Details
-
visit
Description copied from interface:IDexTreeVisitorVisit class- Specified by:
visitin interfaceIDexTreeVisitor- Overrides:
visitin classAbstractVisitor- Returns:
- false for disable child methods and inner classes traversal
- Throws:
JadxException
-
visit
Description copied from interface:IDexTreeVisitorVisit method- Specified by:
visitin interfaceIDexTreeVisitor- Overrides:
visitin classAbstractVisitor
-
replaceStep
-
fixFieldUsage
If field is not visible from use site => cast to origin class -
isFieldVisibleInMethod
-
replaceConstKeys
-
fixPrimitiveCast
-
makeBooleanConvertInsn
-
replaceConstInAnnotations
-
replaceConstsInAnnotationForMethodParamsAttr
-
replaceConstsInAnnotationForAttrNode
-
replaceConstsInAnnotationsAttr
-
replaceConstValue
-
replaceConst
private static void replaceConst(MethodNode mth, ClassNode parentClass, BlockNode block, int i, InsnNode insn) -
processArith
-
inlineCMPInsns
private static void inlineCMPInsns(MethodNode mth, BlockNode block, int i, InsnNode insn, InsnRemover remover) Inline CMP instructions into 'if' to help conditions merging -
checkArrSizes
private static boolean checkArrSizes(MethodNode mth, NewArrayNode newArrInsn, FillArrayInsn fillArrInsn) -
removeCheckCast
-
isCastDuplicate
-
removeStep
Remove unnecessary instructions -
iterativeRemoveStep
-
isResultArgNotUsed
-
processAnonymousConstructor
For args in anonymous constructor invoke apply: - forbid inline into constructor call - make variables final (compiler require this implicitly) -
anonymousCallArgMod
-
getFirstUseSkipMove
Return first usage instruction for arg. If used only once try to follow move chain -
makeFilledArrayInsn
private static InsnNode makeFilledArrayInsn(MethodNode mth, NewArrayNode newArrayNode, FillArrayInsn insn) -
processMoveException
private static void processMoveException(MethodNode mth, BlockNode block, InsnNode insn, InsnRemover remover) -
addFieldUsage
-