当前位置: 首页>>代码示例>>Java>>正文


Java Constant类代码示例

本文整理汇总了Java中com.android.dx.rop.cst.Constant的典型用法代码示例。如果您正苦于以下问题:Java Constant类的具体用法?Java Constant怎么用?Java Constant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Constant类属于com.android.dx.rop.cst包,在下文中一共展示了Constant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isCompatible

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/** {@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();

    if (!(cst instanceof CstLiteralBits)) {
        return false;
    }

    return ((CstLiteralBits) cst).fitsInInt();
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:20,代码来源:Form31i.java

示例2: get

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public IndexedItem get(Constant cst) {
    if (cst == null) {
        throw new NullPointerException("cst == null");
    }

    throwIfNotPrepared();

    Type type = ((CstType) cst).getClassType();
    IndexedItem result = typeIds.get(type);

    if (result == null) {
        throw new IllegalArgumentException("not found: " + cst);
    }

    return result;
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:19,代码来源:TypeIdsSection.java

示例3: isCompatible

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/** {@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);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:24,代码来源:Form35c.java

示例4: isCompatible

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean isCompatible(DalvInsn insn) {
    RegisterSpecList regs = insn.getRegisters();

    if (!((insn instanceof CstInsn) &&
          (regs.size() == 1) &&
          unsignedFitsInNibble(regs.get(0).getReg()))) {
        return false;
    }

    CstInsn ci = (CstInsn) insn;
    Constant cst = ci.getConstant();

    if (!(cst instanceof CstLiteralBits)) {
        return false;
    }

    CstLiteralBits cb = (CstLiteralBits) cst;

    return cb.fitsInInt() && signedFitsInNibble(cb.getIntBits());
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:23,代码来源:Form11n.java

示例5: addConstants

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Helper for {@link #getAllConstants} which adds all the info for
 * a single instruction.
 *
 * @param result {@code non-null;} result set to add to
 * @param insn {@code non-null;} instruction to scrutinize
 */
private static void addConstants(HashSet<Constant> result,
        DalvInsn insn) {
    if (insn instanceof CstInsn) {
        Constant cst = ((CstInsn) insn).getConstant();
        result.add(cst);
    } else if (insn instanceof LocalSnapshot) {
        RegisterSpecSet specs = ((LocalSnapshot) insn).getLocals();
        int size = specs.size();
        for (int i = 0; i < size; i++) {
            addConstants(result, specs.get(i));
        }
    } else if (insn instanceof LocalStart) {
        RegisterSpec spec = ((LocalStart) insn).getLocal();
        addConstants(result, spec);
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:24,代码来源:OutputFinisher.java

示例6: assignIndices

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Helper for {@link #assignIndices} which does assignment for one
 * instruction.
 *
 * @param insn {@code non-null;} the instruction
 * @param callback {@code non-null;} the callback
 */
private static void assignIndices(CstInsn insn,
        DalvCode.AssignIndicesCallback callback) {
    Constant cst = insn.getConstant();
    int index = callback.getIndex(cst);

    if (index >= 0) {
        insn.setIndex(index);
    }

    if (cst instanceof CstMemberRef) {
        CstMemberRef member = (CstMemberRef) cst;
        CstType definer = member.getDefiningClass();
        index = callback.getIndex(definer);
        if (index >= 0) {
            insn.setClassIndex(index);
        }
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:26,代码来源:OutputFinisher.java

示例7: setLatticeValueTo

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Sets a lattice value for a register to value.
 * @param reg SSA register
 * @param value Lattice value
 * @param cst Constant value (may be null)
 * @return true if the lattice value changed.
 */
private boolean setLatticeValueTo(int reg, int value, Constant cst) {
    if (value != CONSTANT) {
        if (latticeValues[reg] != value) {
            latticeValues[reg] = value;
            return true;
        }
        return false;
    } else {
        if (latticeValues[reg] != value
                || !latticeConstants[reg].equals(cst)) {
            latticeValues[reg] = value;
            latticeConstants[reg] = cst;
            return true;
        }
        return false;
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:25,代码来源:SCCP.java

示例8: get

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public IndexedItem get(Constant cst) {
    if (cst == null) {
        throw new NullPointerException("cst == null");
    }

    throwIfNotPrepared();

    IndexedItem result = fieldIds.get((CstFieldRef) cst);

    if (result == null) {
        throw new IllegalArgumentException("not found");
    }

    return result;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:18,代码来源:FieldIdsSection.java

示例9: visitConstant

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/** {@inheritDoc} */
public void visitConstant(int opcode, int offset, int length,
        Constant cst, int value) {
    visitCommon(offset, length, true);

    if ((cst instanceof CstMemberRef) || (cst instanceof CstType) ||
        (cst instanceof CstString)) {
        /*
         * Instructions with these sorts of constants have the
         * possibility of throwing, so this instruction needs to
         * end its block (since it can throw, and possible-throws
         * are branch points).
         */
        visitThrowing(offset, length, true);
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:17,代码来源:BasicBlocker.java

示例10: if

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Gets the {@link IndexedItem} corresponding to the given constant,
 * if it is a constant that has such a correspondence, or return
 * {@code null} if it isn't such a constant. This will throw
 * an exception if the given constant <i>should</i> have been found
 * but wasn't.
 *
 * @param cst {@code non-null;} the constant to look up
 * @return {@code null-ok;} its corresponding item, if it has a corresponding
 * item, or {@code null} if it's not that sort of constant
 */
/*package*/ IndexedItem findItemOrNull(Constant cst) {
    IndexedItem item;

    if (cst instanceof CstString) {
        return stringIds.get(cst);
    } else if (cst instanceof CstType) {
        return typeIds.get(cst);
    } else if (cst instanceof CstBaseMethodRef) {
        return methodIds.get(cst);
    } else if (cst instanceof CstFieldRef) {
        return fieldIds.get(cst);
    } else {
        return null;
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:27,代码来源:DexFile.java

示例11: ClassDataItem

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Constructs an instance. Its sets of members are initially
 * empty.
 *
 * @param thisClass {@code non-null;} what class this data is for, just
 * for listing generation
 */
public ClassDataItem(CstType thisClass) {
    super(1, -1);

    if (thisClass == null) {
        throw new NullPointerException("thisClass == null");
    }

    this.thisClass = thisClass;
    this.staticFields = new ArrayList<EncodedField>(20);
    this.staticValues = new HashMap<EncodedField, Constant>(40);
    this.instanceFields = new ArrayList<EncodedField>(20);
    this.directMethods = new ArrayList<EncodedMethod>(20);
    this.virtualMethods = new ArrayList<EncodedMethod>(20);
    this.staticValuesConstant = null;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:23,代码来源:ClassDataItem.java

示例12: constantToHuman

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Gets the colloquial type name and human form of the type of the
 * given constant, when used as an encoded value.
 *
 * @param cst {@code non-null;} the constant
 * @return {@code non-null;} its type name and human form
 */
public static String constantToHuman(Constant cst) {
    int type = constantToValueType(cst);

    if (type == VALUE_NULL) {
        return "null";
    }

    StringBuilder sb = new StringBuilder();

    sb.append(cst.typeName());
    sb.append(' ');
    sb.append(cst.toHuman());

    return sb.toString();
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:23,代码来源:ValueEncoder.java

示例13: get

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public IndexedItem get(Constant cst) {
    if (cst == null) {
        throw new NullPointerException("cst == null");
    }

    throwIfNotPrepared();

    IndexedItem result = methodIds.get((CstBaseMethodRef) cst);

    if (result == null) {
        throw new IllegalArgumentException("not found");
    }

    return result;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:18,代码来源:MethodIdsSection.java

示例14: replaceDef

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Replaces the instructions that define an array with equivalent registers.
 * For each entry in the array, a register is created, initialized to zero.
 * A mapping between this register and the corresponding array index is
 * added.
 *
 * @param def {@code non-null;} move result instruction for array
 * @param prev {@code non-null;} instruction for instantiating new array
 * @param length size of the new array
 * @param newRegs {@code non-null;} mapping of array indices to new
 * registers to be populated
 */
private void replaceDef(SsaInsn def, SsaInsn prev, int length,
                            ArrayList<RegisterSpec> newRegs) {
    Type resultType = def.getResult().getType();

    // Create new zeroed out registers for each element in the array
    for (int i = 0; i < length; i++) {
        Constant newZero = Zeroes.zeroFor(resultType.getComponentType());
        TypedConstant typedZero = (TypedConstant) newZero;
        RegisterSpec newReg =
            RegisterSpec.make(ssaMeth.makeNewSsaReg(), typedZero);
        newRegs.add(newReg);
        insertPlainInsnBefore(def, RegisterSpecList.EMPTY, newReg,
                                  RegOps.CONST, newZero);
    }
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:28,代码来源:EscapeAnalysis.java

示例15: isCompatible

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/** {@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;
    int cpi = ci.getIndex();

    if (! unsignedFitsInShort(cpi)) {
        return false;
    }

    Constant cst = ci.getConstant();
    return (cst instanceof CstType) ||
        (cst instanceof CstFieldRef);
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:23,代码来源:Form22c.java


注:本文中的com.android.dx.rop.cst.Constant类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。