• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Constant类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: if

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Interns the given constant in the appropriate section of this
 * instance, or do nothing if the given constant isn't the sort
 * that should be interned.
 *
 * @param cst {@code non-null;} constant to possibly intern
 */
/*package*/ void internIfAppropriate(Constant cst) {
    if (cst instanceof CstString) {
        stringIds.intern((CstString) cst);
    } else if (cst instanceof CstType) {
        typeIds.intern((CstType) cst);
    } else if (cst instanceof CstBaseMethodRef) {
        methodIds.intern((CstBaseMethodRef) cst);
    } else if (cst instanceof CstFieldRef) {
        fieldIds.intern((CstFieldRef) cst);
    } else if (cst instanceof CstEnumRef) {
        fieldIds.intern(((CstEnumRef) cst).getFieldRef());
    } else if (cst == null) {
        throw new NullPointerException("cst == null");
    }
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:23,代码来源:DexFile.java


示例17: parseValueAttribute

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Parses an annotation value ({@code element_value}) attribute.
 *
 * @return {@code non-null;} the parsed constant value
 */
public Constant parseValueAttribute() {
    Constant result;

    try {
        result = parseValue();

        if (input.available() != 0) {
            throw new ParseException("extra data in attribute");
        }
    } catch (IOException ex) {
        // ByteArray.MyDataInputStream should never throw.
        throw new RuntimeException("shouldn't happen", ex);
    }

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


示例18: parseElement

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/**
 * Parses a {@link NameValuePair}.
 *
 * @return {@code non-null;} the parsed element
 */
private NameValuePair parseElement() throws IOException {
    requireLength(5);

    int elementNameIndex = input.readUnsignedShort();
    CstString elementName = (CstString) pool.get(elementNameIndex);

    if (observer != null) {
        parsed(2, "element_name: " + elementName.toHuman());
        parsed(0, "value: ");
        changeIndent(1);
    }

    Constant value = parseValue();

    if (observer != null) {
        changeIndent(-1);
    }

    return new NameValuePair(elementName, value);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:26,代码来源:AnnotationParser.java


示例19: SCCP

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
private SCCP(SsaMethod ssaMeth) {
    this.ssaMeth = ssaMeth;
    this.regCount = ssaMeth.getRegCount();
    this.latticeValues = new int[this.regCount];
    this.latticeConstants = new Constant[this.regCount];
    this.cfgWorklist = new ArrayList<SsaBasicBlock>();
    this.cfgPhiWorklist = new ArrayList<SsaBasicBlock>();
    this.executableBlocks = new BitSet(ssaMeth.getBlocks().size());
    this.ssaWorklist = new ArrayList<SsaInsn>();
    this.varyingWorklist = new ArrayList<SsaInsn>();
    this.branchWorklist = new ArrayList<SsaInsn>();
    for (int i = 0; i < this.regCount; i++) {
        latticeValues[i] = TOP;
        latticeConstants[i] = null;
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:17,代码来源:SCCP.java


示例20: visitFillArrayDataInsn

import com.android.dx.rop.cst.Constant; //导入依赖的package包/类
/** {@inheritDoc} */
public void visitFillArrayDataInsn(FillArrayDataInsn insn) {
    SourcePosition pos = insn.getPosition();
    Constant cst = insn.getConstant();
    ArrayList<Constant> values = insn.getInitValues();
    Rop rop = insn.getOpcode();

    if (rop.getBranchingness() != Rop.BRANCH_NONE) {
        throw new RuntimeException("shouldn't happen");
    }
    CodeAddress dataAddress = new CodeAddress(pos);
    ArrayData dataInsn =
        new ArrayData(pos, lastAddress, values, cst);

    TargetInsn fillArrayDataInsn =
        new TargetInsn(Dops.FILL_ARRAY_DATA, pos, getRegs(insn),
                dataAddress);

    addOutput(lastAddress);
    addOutput(fillArrayDataInsn);

    addOutputSuffix(new OddSpacer(pos));
    addOutputSuffix(dataAddress);
    addOutputSuffix(dataInsn);
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:26,代码来源:RopTranslator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Action类代码示例发布时间:2022-05-23
下一篇:
Java Quantity类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap