Search in sources :

Example 1 with InstructionReader

use of com.tencent.tinker.android.dx.instruction.InstructionReader in project tinker by Tencent.

the class InstructionTransformer method transform.

public short[] transform(short[] encodedInstructions) throws DexException {
    ShortArrayCodeOutput out = new ShortArrayCodeOutput(encodedInstructions.length);
    InstructionPromoter ipmo = new InstructionPromoter();
    InstructionWriter iw = new InstructionWriter(out, ipmo);
    InstructionReader ir = new InstructionReader(new ShortArrayCodeInput(encodedInstructions));
    try {
        // First visit, we collect mappings from original target address to promoted target address.
        ir.accept(new InstructionTransformVisitor(ipmo));
        // Then do the real transformation work.
        ir.accept(new InstructionTransformVisitor(iw));
    } catch (EOFException e) {
        throw new DexException(e);
    }
    return out.getArray();
}
Also used : DexException(com.tencent.tinker.android.dex.DexException) ShortArrayCodeOutput(com.tencent.tinker.android.dx.instruction.ShortArrayCodeOutput) InstructionPromoter(com.tencent.tinker.android.dx.instruction.InstructionPromoter) EOFException(java.io.EOFException) ShortArrayCodeInput(com.tencent.tinker.android.dx.instruction.ShortArrayCodeInput) InstructionReader(com.tencent.tinker.android.dx.instruction.InstructionReader) InstructionWriter(com.tencent.tinker.android.dx.instruction.InstructionWriter)

Aggregations

DexException (com.tencent.tinker.android.dex.DexException)1 InstructionPromoter (com.tencent.tinker.android.dx.instruction.InstructionPromoter)1 InstructionReader (com.tencent.tinker.android.dx.instruction.InstructionReader)1 InstructionWriter (com.tencent.tinker.android.dx.instruction.InstructionWriter)1 ShortArrayCodeInput (com.tencent.tinker.android.dx.instruction.ShortArrayCodeInput)1 ShortArrayCodeOutput (com.tencent.tinker.android.dx.instruction.ShortArrayCodeOutput)1 EOFException (java.io.EOFException)1