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


Java RegisterSpec.withType方法代码示例

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


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

示例1: replaceConstants

import com.android.dx.rop.code.RegisterSpec; //导入方法依赖的package包/类
/**
 * Replaces TypeBearers in source register specs with constant type
 * bearers if possible. These are then referenced in later optimization
 * steps.
 */
private void replaceConstants() {
    for (int reg = 0; reg < regCount; reg++) {
        if (latticeValues[reg] != CONSTANT) {
            continue;
        }
        if (!(latticeConstants[reg] instanceof TypedConstant)) {
            // We can't do much with these
            continue;
        }

        SsaInsn defn = ssaMeth.getDefinitionForRegister(reg);
        TypeBearer typeBearer = defn.getResult().getTypeBearer();

        if (typeBearer.isConstant()) {
            /*
             * The definition was a constant already.
             * The uses should be as well.
             */
            continue;
        }

        // Update the destination RegisterSpec with the constant value
        RegisterSpec dest = defn.getResult();
        RegisterSpec newDest
                = dest.withType((TypedConstant)latticeConstants[reg]);
        defn.setResult(newDest);

        /*
         * Update the sources RegisterSpec's of all non-move uses.
         * These will be used in later steps.
         */
        for (SsaInsn insn : ssaMeth.getUseListForRegister(reg)) {
            if (insn.isPhiOrMove()) {
                continue;
            }

            NormalSsaInsn nInsn = (NormalSsaInsn) insn;
            RegisterSpecList sources = insn.getSources();

            int index = sources.indexOfRegister(reg);

            RegisterSpec spec = sources.get(index);
            RegisterSpec newSpec
                    = spec.withType((TypedConstant)latticeConstants[reg]);

            nInsn.changeOneSource(index, newSpec);
        }
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:55,代码来源:SCCP.java

示例2: 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.withType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。