Search in sources :

Example 41 with Constant

use of com.taobao.android.dx.rop.cst.Constant in project atlas by alibaba.

the class Form51l method isCompatible.

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

Example 42 with Constant

use of com.taobao.android.dx.rop.cst.Constant in project atlas by alibaba.

the class AnnotationItem method annotateTo.

/**
     * Write a (listing file) annotation for this instance to the given
     * output, that consumes no bytes of output. This is for annotating
     * a reference to this instance at the point of the reference.
     *
     * @param out {@code non-null;} where to output to
     * @param prefix {@code non-null;} prefix for each line of output
     */
public void annotateTo(AnnotatedOutput out, String prefix) {
    out.annotate(0, prefix + "visibility: " + annotation.getVisibility().toHuman());
    out.annotate(0, prefix + "type: " + annotation.getType().toHuman());
    for (NameValuePair pair : annotation.getNameValuePairs()) {
        CstString name = pair.getName();
        Constant value = pair.getValue();
        out.annotate(0, prefix + name.toHuman() + ": " + ValueEncoder.constantToHuman(value));
    }
}
Also used : NameValuePair(com.taobao.android.dx.rop.annotation.NameValuePair) Constant(com.taobao.android.dx.rop.cst.Constant) CstString(com.taobao.android.dx.rop.cst.CstString)

Aggregations

Constant (com.taobao.android.dx.rop.cst.Constant)42 RegisterSpecList (com.taobao.android.dx.rop.code.RegisterSpecList)17 CstType (com.taobao.android.dx.rop.cst.CstType)13 CstInsn (com.taobao.android.dx.dex.code.CstInsn)12 CstString (com.taobao.android.dx.rop.cst.CstString)12 RegisterSpec (com.taobao.android.dx.rop.code.RegisterSpec)10 TypedConstant (com.taobao.android.dx.rop.cst.TypedConstant)10 CstLiteralBits (com.taobao.android.dx.rop.cst.CstLiteralBits)9 CstFieldRef (com.taobao.android.dx.rop.cst.CstFieldRef)6 CstInteger (com.taobao.android.dx.rop.cst.CstInteger)6 Type (com.taobao.android.dx.rop.type.Type)5 NameValuePair (com.taobao.android.dx.rop.annotation.NameValuePair)4 Insn (com.taobao.android.dx.rop.code.Insn)4 PlainInsn (com.taobao.android.dx.rop.code.PlainInsn)4 CstMethodRef (com.taobao.android.dx.rop.cst.CstMethodRef)4 TypeBearer (com.taobao.android.dx.rop.type.TypeBearer)4 Rop (com.taobao.android.dx.rop.code.Rop)3 ThrowingCstInsn (com.taobao.android.dx.rop.code.ThrowingCstInsn)3 ArrayList (java.util.ArrayList)3 CstInsn (com.taobao.android.dx.rop.code.CstInsn)2