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

Java RopMethod类代码示例

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

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



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

示例1: setupArrays

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Sets up the address arrays.
 */
private void setupArrays(RopMethod method) {
    BasicBlockList blocks = method.getBlocks();
    int sz = blocks.size();

    for (int i = 0; i < sz; i++) {
        BasicBlock one = blocks.get(i);
        int label = one.getLabel();
        Insn insn = one.getInsns().get(0);

        starts[label] = new CodeAddress(insn.getPosition());

        SourcePosition pos = one.getLastInsn().getPosition();

        lasts[label] = new CodeAddress(pos);
        ends[label] = new CodeAddress(pos);
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:21,代码来源:BlockAddresses.java


示例2: StdCatchBuilder

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Constructs an instance. It merely holds onto its parameters for
 * a subsequent call to {@link #build}.
 *
 * @param method {@code non-null;} method to build the list for
 * @param order {@code non-null;} block output order
 * @param addresses {@code non-null;} address objects for each block
 */
public StdCatchBuilder(RopMethod method, int[] order,
        BlockAddresses addresses) {
    if (method == null) {
        throw new NullPointerException("method == null");
    }

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

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

    this.method = method;
    this.order = order;
    this.addresses = addresses;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:27,代码来源:StdCatchBuilder.java


示例3: updateRopStatistics

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Updates the ROP statistics.
 *
 * @param nonOptRmeth non-optimized method
 * @param rmeth optimized method
 */
public static void updateRopStatistics(RopMethod nonOptRmeth,
        RopMethod rmeth) {
    int oldCountInsns
            = nonOptRmeth.getBlocks().getEffectiveInstructionCount();
    int oldCountRegs = nonOptRmeth.getBlocks().getRegCount();

    if (DEBUG) {
        System.err.println("insns (old/new): "
                + oldCountInsns + "/"
                + rmeth.getBlocks().getEffectiveInstructionCount()
                + " regs (o/n):" + oldCountRegs
                + "/"  +  rmeth.getBlocks().getRegCount());
    }

    int newCountInsns
            = rmeth.getBlocks().getEffectiveInstructionCount();

    runningDeltaInsns
        += (newCountInsns - oldCountInsns);

    runningDeltaRegisters
        += (rmeth.getBlocks().getRegCount() - oldCountRegs);

    runningTotalInsns += newCountInsns;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:32,代码来源:CodeStatistics.java


示例4: getRopMethod

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Extracts the resulting {@link RopMethod} from the instance.
 *
 * @return {@code non-null;} the method object
 */
private RopMethod getRopMethod() {

    // Construct the final list of blocks.

    int sz = result.size();
    BasicBlockList bbl = new BasicBlockList(sz);
    for (int i = 0; i < sz; i++) {
        bbl.set(i, result.get(i));
    }
    bbl.setImmutable();

    // Construct the method object to wrap it all up.

    /*
     * Note: The parameter assignment block is always the first
     * that should be executed, hence the second argument to the
     * constructor.
     */
    return new RopMethod(bbl, getSpecialLabel(PARAM_ASSIGNMENT));
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:26,代码来源:Ropper.java


示例5: convertToSsaMethod

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Returns an SSA representation, edge-split and with phi
 * functions placed.
 *
 * @param rmeth input
 * @param paramWidth the total width, in register-units, of the method's
 * parameters
 * @param isStatic {@code true} if this method has no {@code this}
 * pointer argument
 * @return output in SSA form
 */
public static SsaMethod convertToSsaMethod(RopMethod rmeth,
        int paramWidth, boolean isStatic) {
    SsaMethod result
        = SsaMethod.newFromRopMethod(rmeth, paramWidth, isStatic);

    edgeSplit(result);

    LocalVariableInfo localInfo = LocalVariableExtractor.extract(result);

    placePhiFunctions(result, localInfo, 0);
    new SsaRenamer(result).run();

    /*
     * The exit block, added here, is not considered for edge splitting
     * or phi placement since no actual control flows to it.
     */
    result.makeExitBlock();

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


示例6: optimize

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Runs optimization algorthims over this method, and returns a new
 * instance of RopMethod with the changes.
 *
 * @param rmeth method to process
 * @param paramWidth the total width, in register-units, of this method's
 * parameters
 * @param isStatic true if this method has no 'this' pointer argument.
 * @param inPreserveLocals true if local variable info should be preserved,
 * at the cost of some registers and insns
 * @param inAdvice {@code non-null;} translation advice
 * @param steps set of optional optimization steps to run
 * @return optimized method
 */
public static RopMethod optimize(RopMethod rmeth, int paramWidth,
        boolean isStatic, boolean inPreserveLocals,
        TranslationAdvice inAdvice, EnumSet<OptionalStep> steps) {
    SsaMethod ssaMeth = null;

    preserveLocals = inPreserveLocals;
    advice = inAdvice;

    ssaMeth = SsaConverter.convertToSsaMethod(rmeth, paramWidth, isStatic);
    runSsaFormSteps(ssaMeth, steps);

    RopMethod resultMeth = SsaToRop.convertToRopMethod(ssaMeth, false);

    if (resultMeth.getBlocks().getRegCount()
            > advice.getMaxOptimalRegisterCount()) {
        // Try to see if we can squeeze it under the register count bar
        resultMeth = optimizeMinimizeRegisters(rmeth, paramWidth, isStatic,
                steps);
    }
    return resultMeth;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:36,代码来源:Optimizer.java


示例7: optimizeMinimizeRegisters

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Runs the optimizer with a strategy to minimize the number of rop-form
 * registers used by the end result. Dex bytecode does not have instruction
 * forms that take register numbers larger than 15 for all instructions.
 * If we've produced a method that uses more than 16 registers, try again
 * with a different strategy to see if we can get under the bar. The end
 * result will be much more efficient.
 *
 * @param rmeth method to process
 * @param paramWidth the total width, in register-units, of this method's
 * parameters
 * @param isStatic true if this method has no 'this' pointer argument.
 * @param steps set of optional optimization steps to run
 * @return optimized method
 */
private static RopMethod optimizeMinimizeRegisters(RopMethod rmeth,
        int paramWidth, boolean isStatic,
        EnumSet<OptionalStep> steps) {
    SsaMethod ssaMeth;
    RopMethod resultMeth;

    ssaMeth = SsaConverter.convertToSsaMethod(
            rmeth, paramWidth, isStatic);

    EnumSet<OptionalStep> newSteps = steps.clone();

    /*
     * CONST_COLLECTOR trades insns for registers, which is not an
     * appropriate strategy here.
     */
    newSteps.remove(OptionalStep.CONST_COLLECTOR);

    runSsaFormSteps(ssaMeth, newSteps);

    resultMeth = SsaToRop.convertToRopMethod(ssaMeth, true);
    return resultMeth;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:38,代码来源:Optimizer.java


示例8: convertRopToSsaBlocks

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
private void convertRopToSsaBlocks(RopMethod rmeth) {
    BasicBlockList ropBlocks = rmeth.getBlocks();
    int sz = ropBlocks.size();

    blocks = new ArrayList<SsaBasicBlock>(sz + 2);

    for (int i = 0; i < sz; i++) {
        SsaBasicBlock sbb = SsaBasicBlock.newFromRop(rmeth, i, this);
        blocks.add(sbb);
    }

    // Add an no-op entry block.
    int origEntryBlockIndex = rmeth.getBlocks()
            .indexOfLabel(rmeth.getFirstLabel());

    SsaBasicBlock entryBlock
            = blocks.get(origEntryBlockIndex).insertNewPredecessor();

    entryBlockIndex = entryBlock.getIndex();
    exitBlockIndex = -1; // This gets made later.
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:22,代码来源:SsaMethod.java


示例9: getCode

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Extracts the code block from the given method of the given class, or
 * <code>null</code>, if method is native or abstract.
 */
private static DalvCode getCode(Method method, DirectClassFile classFile) {
    boolean isNative = AccessFlags.isNative(method.getAccessFlags());
    boolean isStatic = AccessFlags.isStatic(method.getAccessFlags());
    boolean isAbstract = AccessFlags.isAbstract(method.getAccessFlags());

    if (isNative || isAbstract) {
        return null;
    }

    ConcreteMethod concrete = new ConcreteMethod(method, classFile, false, false);
    TranslationAdvice advice = DexTranslationAdvice.THE_ONE;
    RopMethod rmeth = Ropper.convert(concrete, advice);
    CstMethodRef meth = new CstMethodRef(method.getDefiningClass(), method.getNat());
    int paramSize = meth.getParameterWordCount(isStatic);
    DalvCode code = RopTranslator.translate(rmeth, PositionList.NONE, null, paramSize);
    DalvCode.AssignIndicesCallback callback = new DalvCode.AssignIndicesCallback() {
        public int getIndex(Constant cst) {
            // Everything is at index 0!
            return 0;
        }
    };
    code.assignIndices(callback);
    return code;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:29,代码来源:JDKAnalyzer.java


示例10: updateRopStatistics

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Updates the ROP statistics.
 *
 * @param nonOptRmeth non-optimized method
 * @param rmeth optimized method
 */
public void updateRopStatistics(RopMethod nonOptRmeth,
        RopMethod rmeth) {
    int oldCountInsns
            = nonOptRmeth.getBlocks().getEffectiveInstructionCount();
    int oldCountRegs = nonOptRmeth.getBlocks().getRegCount();

    if (DEBUG) {
        System.err.println("insns (old/new): "
                + oldCountInsns + "/"
                + rmeth.getBlocks().getEffectiveInstructionCount()
                + " regs (o/n):" + oldCountRegs
                + "/"  +  rmeth.getBlocks().getRegCount());
    }

    int newCountInsns
            = rmeth.getBlocks().getEffectiveInstructionCount();

    runningDeltaInsns
        += (newCountInsns - oldCountInsns);

    runningDeltaRegisters
        += (rmeth.getBlocks().getRegCount() - oldCountRegs);

    runningTotalInsns += newCountInsns;
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:32,代码来源:CodeStatistics.java


示例11: convertToSsaMethod

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Returns an SSA representation, edge-split and with phi
 * functions placed.
 *
 * @param rmeth input
 * @param paramWidth the total width, in register-units, of the method's
 * parameters
 * @param isStatic {@code true} if this method has no {@code this}
 * pointer argument
 * @return output in SSA form
 */
public static SsaMethod convertToSsaMethod(Optimizer optimizer, RopMethod rmeth,
        int paramWidth, boolean isStatic) {
    SsaMethod result
        = SsaMethod.newFromRopMethod(rmeth, paramWidth, isStatic);

    edgeSplit(result);

    LocalVariableInfo localInfo = LocalVariableExtractor.extract(result);

    placePhiFunctions(result, localInfo, 0);
    new SsaRenamer(optimizer, result).run();

    /*
     * The exit block, added here, is not considered for edge splitting
     * or phi placement since no actual control flows to it.
     */
    result.makeExitBlock();

    return result;
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:32,代码来源:SsaConverter.java


示例12: optimize

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Runs optimization algorthims over this method, and returns a new
 * instance of RopMethod with the changes.
 *
 * @param rmeth method to process
 * @param paramWidth the total width, in register-units, of this method's
 * parameters
 * @param isStatic true if this method has no 'this' pointer argument.
 * @param inPreserveLocals true if local variable info should be preserved,
 * at the cost of some registers and insns
 * @param inAdvice {@code non-null;} translation advice
 * @param steps set of optional optimization steps to run
 * @return optimized method
 */
public RopMethod optimize(RopMethod rmeth, int paramWidth,
        boolean isStatic, boolean inPreserveLocals,
        TranslationAdvice inAdvice, EnumSet<OptionalStep> steps) {
    SsaMethod ssaMeth = null;

    preserveLocals = inPreserveLocals;
    advice = inAdvice;

    ssaMeth = SsaConverter.convertToSsaMethod(this, rmeth, paramWidth, isStatic);
    runSsaFormSteps(ssaMeth, steps);

    RopMethod resultMeth = SsaToRop.convertToRopMethod(this, ssaMeth, false);

    if (resultMeth.getBlocks().getRegCount()
            > advice.getMaxOptimalRegisterCount()) {
        // Try to see if we can squeeze it under the register count bar
        resultMeth = optimizeMinimizeRegisters(rmeth, paramWidth, isStatic,
                steps);
    }
    return resultMeth;
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:36,代码来源:Optimizer.java


示例13: optimizeMinimizeRegisters

import com.android.dx.rop.code.RopMethod; //导入依赖的package包/类
/**
 * Runs the optimizer with a strategy to minimize the number of rop-form
 * registers used by the end result. Dex bytecode does not have instruction
 * forms that take register numbers larger than 15 for all instructions.
 * If we've produced a method that uses more than 16 registers, try again
 * with a different strategy to see if we can get under the bar. The end
 * result will be much more efficient.
 *
 * @param rmeth method to process
 * @param paramWidth the total width, in register-units, of this method's
 * parameters
 * @param isStatic true if this method has no 'this' pointer argument.
 * @param steps set of optional optimization steps to run
 * @return optimized method
 */
private RopMethod optimizeMinimizeRegisters(RopMethod rmeth,
        int paramWidth, boolean isStatic,
        EnumSet<OptionalStep> steps) {
    SsaMethod ssaMeth;
    RopMethod resultMeth;

    ssaMeth = SsaConverter.convertToSsaMethod(
            this, rmeth, paramWidth, isStatic);

    EnumSet<OptionalStep> newSteps = steps.clone();

    /*
     * CONST_COLLECTOR trades insns for registers, which is not an
     * appropriate strategy here.
     */
    newSteps.remove(OptionalStep.CONST_COLLECTOR);

    runSsaFormSteps(ssaMeth, newSteps);

    resultMeth = SsaToRop.convertToRopMethod(this, ssaMeth, true);
    return resultMeth;
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:38,代码来源:Optimizer.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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