Package org.jf.dexlib2.builder
Class MutableMethodImplementation
java.lang.Object
org.jf.dexlib2.builder.MutableMethodImplementation
- All Implemented Interfaces:
MethodImplementation
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean(package private) final ArrayList<MethodLocation> private final intprivate final ArrayList<BuilderTryBlock> -
Constructor Summary
ConstructorsConstructorDescriptionMutableMethodImplementation(int registerCount) MutableMethodImplementation(MethodImplementation methodImplementation) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddCatch(TypeReference type, Label from, Label to, Label handler) voidaddInstruction(int index, BuilderInstruction instruction) voidaddInstruction(BuilderInstruction instruction) private voidconvertAndSetInstruction(MethodLocation location, int[] codeAddressToIndex, Instruction instruction) private BuilderDebugItemconvertDebugItem(DebugItem debugItem) private MethodLocationfindSwitchForPayload(MethodLocation payloadLocation) private voidGet a list of debug items for this method.private BuilderInstructiongetFirstNonNop(int startIndex) Gets the instructions in this method.intGets the number of registers in this method.Gets a list of the try blocks defined for this method.private intmapCodeAddressToIndex(int codeAddress) private intmapCodeAddressToIndex(int[] codeAddressToIndex, int codeAddress) private BuilderArrayPayloadnewBuilderArrayPayload(ArrayPayload instruction) private BuilderInstruction10tnewBuilderInstruction10t(int codeAddress, int[] codeAddressToIndex, Instruction10t instruction) private BuilderInstruction10xnewBuilderInstruction10x(Instruction10x instruction) private BuilderInstruction11nnewBuilderInstruction11n(Instruction11n instruction) private BuilderInstruction11xnewBuilderInstruction11x(Instruction11x instruction) private BuilderInstruction12xnewBuilderInstruction12x(Instruction12x instruction) private BuilderInstruction20bcnewBuilderInstruction20bc(Instruction20bc instruction) private BuilderInstruction20tnewBuilderInstruction20t(int codeAddress, int[] codeAddressToIndex, Instruction20t instruction) private BuilderInstruction21cnewBuilderInstruction21c(Instruction21c instruction) private BuilderInstruction21ihnewBuilderInstruction21ih(Instruction21ih instruction) private BuilderInstruction21lhnewBuilderInstruction21lh(Instruction21lh instruction) private BuilderInstruction21snewBuilderInstruction21s(Instruction21s instruction) private BuilderInstruction21tnewBuilderInstruction21t(int codeAddress, int[] codeAddressToIndex, Instruction21t instruction) private BuilderInstruction22bnewBuilderInstruction22b(Instruction22b instruction) private BuilderInstruction22cnewBuilderInstruction22c(Instruction22c instruction) private BuilderInstruction22csnewBuilderInstruction22cs(Instruction22cs instruction) private BuilderInstruction22snewBuilderInstruction22s(Instruction22s instruction) private BuilderInstruction22tnewBuilderInstruction22t(int codeAddress, int[] codeAddressToIndex, Instruction22t instruction) private BuilderInstruction22xnewBuilderInstruction22x(Instruction22x instruction) private BuilderInstruction23xnewBuilderInstruction23x(Instruction23x instruction) private BuilderInstruction30tnewBuilderInstruction30t(int codeAddress, int[] codeAddressToIndex, Instruction30t instruction) private BuilderInstruction31cnewBuilderInstruction31c(Instruction31c instruction) private BuilderInstruction31inewBuilderInstruction31i(Instruction31i instruction) private BuilderInstruction31tnewBuilderInstruction31t(MethodLocation location, int[] codeAddressToIndex, Instruction31t instruction) private BuilderInstruction32xnewBuilderInstruction32x(Instruction32x instruction) private BuilderInstruction35cnewBuilderInstruction35c(Instruction35c instruction) private BuilderInstruction35minewBuilderInstruction35mi(Instruction35mi instruction) private BuilderInstruction35msnewBuilderInstruction35ms(Instruction35ms instruction) private BuilderInstruction3rcnewBuilderInstruction3rc(Instruction3rc instruction) private BuilderInstruction3rminewBuilderInstruction3rmi(Instruction3rmi instruction) private BuilderInstruction3rmsnewBuilderInstruction3rms(Instruction3rms instruction) private BuilderInstruction51lnewBuilderInstruction51l(Instruction51l instruction) private BuilderPackedSwitchPayloadnewBuilderPackedSwitchPayload(MethodLocation location, int[] codeAddressToIndex, PackedSwitchPayload instruction) private BuilderSparseSwitchPayloadnewBuilderSparseSwitchPayload(MethodLocation location, int[] codeAddressToIndex, SparseSwitchPayload instruction) private LabelnewLabel(int[] codeAddressToIndex, int codeAddress) newLabelForAddress(int codeAddress) newLabelForIndex(int instructionIndex) newSwitchPayloadReferenceLabel(MethodLocation switchLocation, int[] codeAddressToIndex, int codeAddress) voidremoveInstruction(int index) voidreplaceInstruction(int index, BuilderInstruction replacementInstruction) private voidsetInstruction(MethodLocation location, BuilderInstruction instruction) voidswapInstructions(int index1, int index2)
-
Field Details
-
registerCount
private final int registerCount -
instructionList
-
tryBlocks
-
fixInstructions
private boolean fixInstructions
-
-
Constructor Details
-
MutableMethodImplementation
-
MutableMethodImplementation
public MutableMethodImplementation(int registerCount)
-
-
Method Details
-
getRegisterCount
public int getRegisterCount()Description copied from interface:MethodImplementationGets the number of registers in this method.- Specified by:
getRegisterCountin interfaceMethodImplementation- Returns:
- The number of register in this method.
-
getInstructions
Description copied from interface:MethodImplementationGets the instructions in this method.- Specified by:
getInstructionsin interfaceMethodImplementation- Returns:
- An Iterable of the instructions in this method
-
getTryBlocks
Description copied from interface:MethodImplementationGets a list of the try blocks defined for this method. Try blocks may overlap freely, and do not need to be strictly nested, as in java. This is a more relaxed requirement than specified by the dex format, where try blocks may not overlap, and must be specified in ascending order. When writing to a dex file, the try blocks will be massaged into the appropriate format. In any region where there are overlapping try blocks, set of exception handlers for the overlapping region will consist of the union of all handlers in any try block that covers that region. If multiple overlapping try blocks define a handler for the same exception type, or define a catch-all handler, then those duplicate handlers must use the same handler offset.- Specified by:
getTryBlocksin interfaceMethodImplementation- Returns:
- A list of the TryBlock items
-
getDebugItems
Description copied from interface:MethodImplementationGet a list of debug items for this method. This generally matches the semantics of the debug_info_item in the dex specification, although in an easier to digest form. The addresses of the DebugItems in the returned list will be in non-descending order.- Specified by:
getDebugItemsin interfaceMethodImplementation- Returns:
- A list of DebugInfo items
-
addCatch
public void addCatch(@Nullable TypeReference type, @Nonnull Label from, @Nonnull Label to, @Nonnull Label handler) -
addCatch
-
addCatch
-
addInstruction
-
addInstruction
-
replaceInstruction
-
removeInstruction
public void removeInstruction(int index) -
swapInstructions
public void swapInstructions(int index1, int index2) -
getFirstNonNop
-
fixInstructions
private void fixInstructions() -
mapCodeAddressToIndex
private int mapCodeAddressToIndex(@Nonnull int[] codeAddressToIndex, int codeAddress) -
mapCodeAddressToIndex
private int mapCodeAddressToIndex(int codeAddress) -
newLabelForAddress
-
newLabelForIndex
-
newLabel
-
newSwitchPayloadReferenceLabel
@Nonnull public Label newSwitchPayloadReferenceLabel(@Nonnull MethodLocation switchLocation, @Nonnull int[] codeAddressToIndex, int codeAddress) -
setInstruction
private void setInstruction(@Nonnull MethodLocation location, @Nonnull BuilderInstruction instruction) -
convertAndSetInstruction
private void convertAndSetInstruction(@Nonnull MethodLocation location, int[] codeAddressToIndex, @Nonnull Instruction instruction) -
newBuilderInstruction10t
@Nonnull private BuilderInstruction10t newBuilderInstruction10t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction10t instruction) -
newBuilderInstruction10x
@Nonnull private BuilderInstruction10x newBuilderInstruction10x(@Nonnull Instruction10x instruction) -
newBuilderInstruction11n
@Nonnull private BuilderInstruction11n newBuilderInstruction11n(@Nonnull Instruction11n instruction) -
newBuilderInstruction11x
@Nonnull private BuilderInstruction11x newBuilderInstruction11x(@Nonnull Instruction11x instruction) -
newBuilderInstruction12x
@Nonnull private BuilderInstruction12x newBuilderInstruction12x(@Nonnull Instruction12x instruction) -
newBuilderInstruction20bc
@Nonnull private BuilderInstruction20bc newBuilderInstruction20bc(@Nonnull Instruction20bc instruction) -
newBuilderInstruction20t
@Nonnull private BuilderInstruction20t newBuilderInstruction20t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction20t instruction) -
newBuilderInstruction21c
@Nonnull private BuilderInstruction21c newBuilderInstruction21c(@Nonnull Instruction21c instruction) -
newBuilderInstruction21ih
@Nonnull private BuilderInstruction21ih newBuilderInstruction21ih(@Nonnull Instruction21ih instruction) -
newBuilderInstruction21lh
@Nonnull private BuilderInstruction21lh newBuilderInstruction21lh(@Nonnull Instruction21lh instruction) -
newBuilderInstruction21s
@Nonnull private BuilderInstruction21s newBuilderInstruction21s(@Nonnull Instruction21s instruction) -
newBuilderInstruction21t
@Nonnull private BuilderInstruction21t newBuilderInstruction21t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction21t instruction) -
newBuilderInstruction22b
@Nonnull private BuilderInstruction22b newBuilderInstruction22b(@Nonnull Instruction22b instruction) -
newBuilderInstruction22c
@Nonnull private BuilderInstruction22c newBuilderInstruction22c(@Nonnull Instruction22c instruction) -
newBuilderInstruction22cs
@Nonnull private BuilderInstruction22cs newBuilderInstruction22cs(@Nonnull Instruction22cs instruction) -
newBuilderInstruction22s
@Nonnull private BuilderInstruction22s newBuilderInstruction22s(@Nonnull Instruction22s instruction) -
newBuilderInstruction22t
@Nonnull private BuilderInstruction22t newBuilderInstruction22t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction22t instruction) -
newBuilderInstruction22x
@Nonnull private BuilderInstruction22x newBuilderInstruction22x(@Nonnull Instruction22x instruction) -
newBuilderInstruction23x
@Nonnull private BuilderInstruction23x newBuilderInstruction23x(@Nonnull Instruction23x instruction) -
newBuilderInstruction30t
@Nonnull private BuilderInstruction30t newBuilderInstruction30t(int codeAddress, int[] codeAddressToIndex, @Nonnull Instruction30t instruction) -
newBuilderInstruction31c
@Nonnull private BuilderInstruction31c newBuilderInstruction31c(@Nonnull Instruction31c instruction) -
newBuilderInstruction31i
@Nonnull private BuilderInstruction31i newBuilderInstruction31i(@Nonnull Instruction31i instruction) -
newBuilderInstruction31t
@Nonnull private BuilderInstruction31t newBuilderInstruction31t(@Nonnull MethodLocation location, int[] codeAddressToIndex, @Nonnull Instruction31t instruction) -
newBuilderInstruction32x
@Nonnull private BuilderInstruction32x newBuilderInstruction32x(@Nonnull Instruction32x instruction) -
newBuilderInstruction35c
@Nonnull private BuilderInstruction35c newBuilderInstruction35c(@Nonnull Instruction35c instruction) -
newBuilderInstruction35mi
@Nonnull private BuilderInstruction35mi newBuilderInstruction35mi(@Nonnull Instruction35mi instruction) -
newBuilderInstruction35ms
@Nonnull private BuilderInstruction35ms newBuilderInstruction35ms(@Nonnull Instruction35ms instruction) -
newBuilderInstruction3rc
@Nonnull private BuilderInstruction3rc newBuilderInstruction3rc(@Nonnull Instruction3rc instruction) -
newBuilderInstruction3rmi
@Nonnull private BuilderInstruction3rmi newBuilderInstruction3rmi(@Nonnull Instruction3rmi instruction) -
newBuilderInstruction3rms
@Nonnull private BuilderInstruction3rms newBuilderInstruction3rms(@Nonnull Instruction3rms instruction) -
newBuilderInstruction51l
@Nonnull private BuilderInstruction51l newBuilderInstruction51l(@Nonnull Instruction51l instruction) -
findSwitchForPayload
-
newBuilderPackedSwitchPayload
@Nonnull private BuilderPackedSwitchPayload newBuilderPackedSwitchPayload(@Nonnull MethodLocation location, @Nonnull int[] codeAddressToIndex, @Nonnull PackedSwitchPayload instruction) -
newBuilderSparseSwitchPayload
@Nonnull private BuilderSparseSwitchPayload newBuilderSparseSwitchPayload(@Nonnull MethodLocation location, @Nonnull int[] codeAddressToIndex, @Nonnull SparseSwitchPayload instruction) -
newBuilderArrayPayload
-
convertDebugItem
-