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


Java RegisterSpec.getType方法代码示例

本文整理汇总了Java中com.android.dx.rop.code.RegisterSpec.getType方法的典型用法代码示例。如果您正苦于以下问题:Java RegisterSpec.getType方法的具体用法?Java RegisterSpec.getType怎么用?Java RegisterSpec.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.dx.rop.code.RegisterSpec的用法示例。


在下文中一共展示了RegisterSpec.getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addConstants

import com.android.dx.rop.code.RegisterSpec; //导入方法依赖的package包/类
/**
 * Helper for {@link #getAllConstants} which adds all the info for
 * a single {@code RegisterSpec}.
 *
 * @param result {@code non-null;} result set to add to
 * @param spec {@code null-ok;} register spec to add
 */
private static void addConstants(HashSet<Constant> result,
        RegisterSpec spec) {
    if (spec == null) {
        return;
    }

    LocalItem local = spec.getLocalItem();
    CstString name = local.getName();
    CstString signature = local.getSignature();
    Type type = spec.getType();

    if (type != Type.KNOWN_NULL) {
        result.add(CstType.intern(type));
    }

    if (name != null) {
        result.add(name);
    }

    if (signature != null) {
        result.add(signature);
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:31,代码来源:OutputFinisher.java

示例2: processMoveResultPseudoInsn

import com.android.dx.rop.code.RegisterSpec; //导入方法依赖的package包/类
/**
 * Determine the origin of a move result pseudo instruction that generates
 * an object. Creates a new EscapeSet for the new object accordingly.
 *
 * @param insn {@code non-null;} move result pseudo instruction to process
 * @return {@code non-null;} an EscapeSet for the object referred to by the
 * move result pseudo instruction
 */
private EscapeSet processMoveResultPseudoInsn(SsaInsn insn) {
    RegisterSpec result = insn.getResult();
    SsaInsn prevSsaInsn = getInsnForMove(insn);
    int prevOpcode = prevSsaInsn.getOpcode().getOpcode();
    EscapeSet escSet;
    RegisterSpec prevSource;

    switch(prevOpcode) {
       // New instance / Constant
        case RegOps.NEW_INSTANCE:
        case RegOps.CONST:
            escSet = new EscapeSet(result.getReg(), regCount,
                                       EscapeState.NONE);
            break;
        // New array
        case RegOps.NEW_ARRAY:
        case RegOps.FILLED_NEW_ARRAY:
            prevSource = prevSsaInsn.getSources().get(0);
            if (prevSource.getTypeBearer().isConstant()) {
                // New fixed array
                escSet = new EscapeSet(result.getReg(), regCount,
                                           EscapeState.NONE);
                escSet.replaceableArray = true;
            } else {
                // New variable array
                escSet = new EscapeSet(result.getReg(), regCount,
                                           EscapeState.GLOBAL);
            }
            break;
        // Loading a static object
        case RegOps.GET_STATIC:
            escSet = new EscapeSet(result.getReg(), regCount,
                                       EscapeState.GLOBAL);
            break;
        // Type cast / load an object from a field or array
        case RegOps.CHECK_CAST:
        case RegOps.GET_FIELD:
        case RegOps.AGET:
            prevSource = prevSsaInsn.getSources().get(0);
            int setIndex = findSetIndex(prevSource);

            // Set should already exist, try to find it
            if (setIndex != latticeValues.size()) {
                escSet = latticeValues.get(setIndex);
                escSet.regSet.set(result.getReg());
                return escSet;
            }

            // Set not found, must be either null or unknown
            if (prevSource.getType() == Type.KNOWN_NULL) {
                escSet = new EscapeSet(result.getReg(), regCount,
                                           EscapeState.NONE);
           } else {
                escSet = new EscapeSet(result.getReg(), regCount,
                                           EscapeState.GLOBAL);
            }
            break;
        default:
            return null;
    }

    // Add the newly created escSet to the lattice and return it
    latticeValues.add(escSet);
    return escSet;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:74,代码来源:EscapeAnalysis.java

示例3: filterSpec

import com.android.dx.rop.code.RegisterSpec; //导入方法依赖的package包/类
/**
 * Converts a given spec into the form acceptable for use in a
 * local list. This, in particular, transforms the "known
 * null" type into simply {@code Object}. This method needs to
 * be called for any spec that is on its way into a locals
 * list.
 *
 * <p>This isn't necessarily the cleanest way to achieve the
 * goal of not representing known nulls in a locals list, but
 * it gets the job done.</p>
 *
 * @param orig {@code null-ok;} the original spec
 * @return {@code null-ok;} an appropriately modified spec, or the
 * original if nothing needs to be done
 */
private static RegisterSpec filterSpec(RegisterSpec orig) {
    if ((orig != null) && (orig.getType() == Type.KNOWN_NULL)) {
        return orig.withType(Type.OBJECT);
    }

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


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