Search in sources :

Example 6 with CstInsn

use of com.taobao.android.dx.dex.code.CstInsn in project atlas by alibaba.

the class Form35c method isCompatible.

/** {@inheritDoc} */
@Override
public boolean isCompatible(DalvInsn insn) {
    if (!(insn instanceof CstInsn)) {
        return false;
    }
    CstInsn ci = (CstInsn) insn;
    int cpi = ci.getIndex();
    if (!unsignedFitsInShort(cpi)) {
        return false;
    }
    Constant cst = ci.getConstant();
    if (!((cst instanceof CstMethodRef) || (cst instanceof CstType))) {
        return false;
    }
    RegisterSpecList regs = ci.getRegisters();
    return (wordCount(regs) >= 0);
}
Also used : CstInsn(com.taobao.android.dx.dex.code.CstInsn) Constant(com.taobao.android.dx.rop.cst.Constant) CstType(com.taobao.android.dx.rop.cst.CstType) CstMethodRef(com.taobao.android.dx.rop.cst.CstMethodRef) RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList)

Example 7 with CstInsn

use of com.taobao.android.dx.dex.code.CstInsn in project atlas by alibaba.

the class Form35c method writeTo.

/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    int cpi = ((CstInsn) insn).getIndex();
    RegisterSpecList regs = explicitize(insn.getRegisters());
    int sz = regs.size();
    int r0 = (sz > 0) ? regs.get(0).getReg() : 0;
    int r1 = (sz > 1) ? regs.get(1).getReg() : 0;
    int r2 = (sz > 2) ? regs.get(2).getReg() : 0;
    int r3 = (sz > 3) ? regs.get(3).getReg() : 0;
    int r4 = (sz > 4) ? regs.get(4).getReg() : 0;
    write(out, opcodeUnit(insn, // encode the fifth operand here
    makeByte(r4, sz)), (short) cpi, codeUnit(r0, r1, r2, r3));
}
Also used : CstInsn(com.taobao.android.dx.dex.code.CstInsn) RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList)

Example 8 with CstInsn

use of com.taobao.android.dx.dex.code.CstInsn in project atlas by alibaba.

the class Form22c method writeTo.

/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    int cpi = ((CstInsn) insn).getIndex();
    write(out, opcodeUnit(insn, makeByte(regs.get(0).getReg(), regs.get(1).getReg())), (short) cpi);
}
Also used : CstInsn(com.taobao.android.dx.dex.code.CstInsn) RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList)

Example 9 with CstInsn

use of com.taobao.android.dx.dex.code.CstInsn in project atlas by alibaba.

the class Form22s method isCompatible.

/** {@inheritDoc} */
@Override
public boolean isCompatible(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    if (!((insn instanceof CstInsn) && (regs.size() == 2) && unsignedFitsInNibble(regs.get(0).getReg()) && unsignedFitsInNibble(regs.get(1).getReg()))) {
        return false;
    }
    CstInsn ci = (CstInsn) insn;
    Constant cst = ci.getConstant();
    if (!(cst instanceof CstLiteralBits)) {
        return false;
    }
    CstLiteralBits cb = (CstLiteralBits) cst;
    return cb.fitsInInt() && signedFitsInShort(cb.getIntBits());
}
Also used : CstInsn(com.taobao.android.dx.dex.code.CstInsn) CstLiteralBits(com.taobao.android.dx.rop.cst.CstLiteralBits) Constant(com.taobao.android.dx.rop.cst.Constant) RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList)

Example 10 with CstInsn

use of com.taobao.android.dx.dex.code.CstInsn in project atlas by alibaba.

the class Form31c method writeTo.

/** {@inheritDoc} */
@Override
public void writeTo(AnnotatedOutput out, DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();
    int cpi = ((CstInsn) insn).getIndex();
    write(out, opcodeUnit(insn, regs.get(0).getReg()), cpi);
}
Also used : CstInsn(com.taobao.android.dx.dex.code.CstInsn) RegisterSpecList(com.taobao.android.dx.rop.code.RegisterSpecList)

Aggregations

CstInsn (com.taobao.android.dx.dex.code.CstInsn)17 RegisterSpecList (com.taobao.android.dx.rop.code.RegisterSpecList)17 Constant (com.taobao.android.dx.rop.cst.Constant)12 CstLiteralBits (com.taobao.android.dx.rop.cst.CstLiteralBits)6 CstType (com.taobao.android.dx.rop.cst.CstType)5 CstFieldRef (com.taobao.android.dx.rop.cst.CstFieldRef)3 RegisterSpec (com.taobao.android.dx.rop.code.RegisterSpec)2 CstMethodRef (com.taobao.android.dx.rop.cst.CstMethodRef)2 CstString (com.taobao.android.dx.rop.cst.CstString)2 CstLiteral64 (com.taobao.android.dx.rop.cst.CstLiteral64)1