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


Java IntList类代码示例

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


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

示例1: combineBlocks

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Combines blocks proven identical into one alpha block, re-writing
 * all of the successor links that point to the beta blocks to point
 * to the alpha block instead.
 *
 * @param alphaLabel block that will replace all the beta block
 * @param betaLabels label list of blocks to combine
 */
private void combineBlocks(int alphaLabel, IntList betaLabels) {
    int szBetas = betaLabels.size();

    for (int i = 0; i < szBetas; i++) {
        int betaLabel = betaLabels.get(i);
        BasicBlock bb = blocks.labelToBlock(betaLabel);
        IntList preds = ropMethod.labelToPredecessors(bb.getLabel());
        int szPreds = preds.size();

        for (int j = 0; j < szPreds; j++) {
            BasicBlock predBlock = newBlocks.labelToBlock(preds.get(j));
            replaceSucc(predBlock, betaLabel, alphaLabel);
        }
    }
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:24,代码来源:IdenticalBlockCombiner.java

示例2: shouldPack

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Determines whether the given list of cases warrant being packed.
 *
 * @param cases {@code non-null;} sorted list of cases
 * @return {@code true} iff the table encoding the cases
 * should be packed
 */
private static boolean shouldPack(IntList cases) {
    int sz = cases.size();

    if (sz < 2) {
        return true;
    }

    long packedSize = packedCodeSize(cases);
    long sparseSize = sparseCodeSize(cases);

    /*
     * We pick the packed representation if it is possible and
     * would be as small or smaller than 5/4 of the sparse
     * representation. That is, we accept some size overhead on
     * the packed representation, since that format is faster to
     * execute at runtime.
     */
    return (packedSize >= 0) && (packedSize <= ((sparseSize * 5) / 4));
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:27,代码来源:SwitchData.java

示例3: BasicBlocker

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Constructs an instance. This class is not publicly instantiable; use
 * {@link #identifyBlocks}.
 *
 * @param method {@code non-null;} method to convert
 */
private BasicBlocker(ConcreteMethod method) {
    if (method == null) {
        throw new NullPointerException("method == null");
    }

    this.method = method;

    /*
     * The "+1" below is so the idx-past-end is also valid,
     * avoiding a special case, but without preventing
     * flow-of-control falling past the end of the method from
     * getting properly reported.
     */
    int sz = method.getCode().size() + 1;

    workSet = Bits.makeBitSet(sz);
    liveSet = Bits.makeBitSet(sz);
    blockSet = Bits.makeBitSet(sz);
    targetLists = new IntList[sz];
    catchLists = new ByteCatchList[sz];
    previousOffset = -1;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:29,代码来源:BasicBlocker.java

示例4: Frame

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param locals {@code non-null;} the locals array to use
 * @param stack {@code non-null;} the execution stack to use
 * @param subroutines {@code non-null;} list of subroutine start labels for
 * subroutines this frame is nested in
 */
private Frame(LocalsArray locals,
        ExecutionStack stack, IntList subroutines) {
    if (locals == null) {
        throw new NullPointerException("locals == null");
    }

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

    subroutines.throwIfMutable();

    this.locals = locals;
    this.stack = stack;
    this.subroutines = subroutines;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:25,代码来源:Frame.java

示例5: mergeWith

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Merges two frames. If the merged result is the same as this frame,
 * then this instance is returned.
 *
 * @param other {@code non-null;} another frame
 * @return {@code non-null;} the result of merging the two frames
 */
public Frame mergeWith(Frame other) {
    LocalsArray resultLocals;
    ExecutionStack resultStack;
    IntList resultSubroutines;

    resultLocals = getLocals().merge(other.getLocals());
    resultStack = getStack().merge(other.getStack());
    resultSubroutines = mergeSubroutineLists(other.subroutines);

    resultLocals = adjustLocalsForSubroutines(
            resultLocals, resultSubroutines);

    if ((resultLocals == getLocals())
            && (resultStack == getStack())
            && subroutines == resultSubroutines) {
        return this;
    }

    return new Frame(resultLocals, resultStack, resultSubroutines);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:28,代码来源:Frame.java

示例6: mergeSubroutineLists

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Merges this frame's subroutine lists with another. The result
 * is the deepest common nesting (effectively, the common prefix of the
 * two lists).
 *
 * @param otherSubroutines label list of subroutine start blocks, from
 * least-nested to most-nested.
 * @return {@code non-null;} merged subroutine nest list as described above
 */
private IntList mergeSubroutineLists(IntList otherSubroutines) {
    if (subroutines.equals(otherSubroutines)) {
        return subroutines;
    }

    IntList resultSubroutines = new IntList();

    int szSubroutines = subroutines.size();
    int szOthers = otherSubroutines.size();
    for (int i = 0; i < szSubroutines && i < szOthers
            && (subroutines.get(i) == otherSubroutines.get(i)); i++) {
        resultSubroutines.add(i);
    }

    resultSubroutines.setImmutable();

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

示例7: getSuccessors

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Generates a list of subroutine successors. Note: successor blocks
 * could be listed more than once. This is ok, because this successor
 * list (and the block it's associated with) will be copied and inlined
 * before we leave the ropper. Redundent successors will result in
 * redundent (no-op) merges.
 *
 * @return all currently known successors
 * (return destinations) for that subroutine
 */
IntList getSuccessors() {
    IntList successors = new IntList(callerBlocks.size());

    /*
     * For each subroutine caller, get it's target. If the
     * target is us, add the ret target (subroutine successor)
     * to our list
     */

    for (int label = callerBlocks.nextSetBit(0); label >= 0;
         label = callerBlocks.nextSetBit(label+1)) {
        BasicBlock subCaller = labelToBlock(label);
        successors.add(subCaller.getSuccessors().get(0));
    }

    successors.setImmutable();

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

示例8: addOrReplaceBlockNoDelete

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Adds or replaces a block in the output result. Do not delete
 * any successors.
 *
 * @param block {@code non-null;} the block to add or replace
 * @param subroutines {@code non-null;} subroutine label list
 * as described in {@link Frame#getSubroutines}
 * @return {@code true} if the block was replaced or
 * {@code false} if it was added for the first time
 */
private boolean addOrReplaceBlockNoDelete(BasicBlock block,
        IntList subroutines) {
    if (block == null) {
        throw new NullPointerException("block == null");
    }

    int idx = labelToResultIndex(block.getLabel());
    boolean ret;

    if (idx < 0) {
        ret = false;
    } else {
        result.remove(idx);
        resultSubroutines.remove(idx);
        ret = true;
    }

    result.add(block);
    subroutines.throwIfMutable();
    resultSubroutines.add(subroutines);
    return ret;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:33,代码来源:Ropper.java

示例9: deleteUnreachableBlocks

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Deletes all blocks that cannot be reached. This is run to delete
 * original subroutine blocks after subroutine inlining.
 */
private void deleteUnreachableBlocks() {
    final IntList reachableLabels = new IntList(result.size());

    // subroutine inlining is done now and we won't update this list here
    resultSubroutines.clear();

    forEachNonSubBlockDepthFirst(getSpecialLabel(PARAM_ASSIGNMENT),
            new BasicBlock.Visitor() {

        public void visitBlock(BasicBlock b) {
            reachableLabels.add(b.getLabel());
        }
    });

    reachableLabels.sort();

    for (int i = result.size() - 1 ; i >= 0 ; i--) {
        if (reachableLabels.indexOf(result.get(i).getLabel()) < 0) {
            result.remove(i);
            // unnecessary here really, since subroutine inlining is done
            //resultSubroutines.remove(i);
        }
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:29,代码来源:Ropper.java

示例10: preferredSuccessorOf

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Gets the preferred successor for the given block. If the block
 * only has one successor, then that is the preferred successor.
 * Otherwise, if the block has a primay successor, then that is
 * the preferred successor. If the block has no successors, then
 * this returns {@code null}.
 *
 * @param block {@code non-null;} the block in question
 * @return {@code null-ok;} the preferred successor, if any
 */
public BasicBlock preferredSuccessorOf(BasicBlock block) {
    int primarySuccessor = block.getPrimarySuccessor();
    IntList successors = block.getSuccessors();
    int succSize = successors.size();

    switch (succSize) {
        case 0: {
            return null;
        }
        case 1: {
            return labelToBlock(successors.get(0));
        }
    }

    if (primarySuccessor != -1) {
        return labelToBlock(primarySuccessor);
    } else {
        return labelToBlock(successors.get(0));
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:31,代码来源:BasicBlockList.java

示例11: replaceSucc

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Replaces one of a block's successors with a different label. Constructs
 * an updated BasicBlock instance and places it in {@code newBlocks}.
 *
 * @param block block to replace
 * @param oldLabel label of successor to replace
 * @param newLabel label of new successor
 */
private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) {
    IntList newSuccessors = block.getSuccessors().mutableCopy();
    int newPrimarySuccessor;

    newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel);
    newPrimarySuccessor = block.getPrimarySuccessor();

    if (newPrimarySuccessor == oldLabel) {
        newPrimarySuccessor = newLabel;
    }

    newSuccessors.setImmutable();

    BasicBlock newBB = new BasicBlock(block.getLabel(),
            block.getInsns(), newSuccessors, newPrimarySuccessor);

    newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:27,代码来源:IdenticalBlockCombiner.java

示例12: SwitchData

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Constructs an instance. The output address of this instance is initially
 * unknown ({@code -1}).
 *
 * @param position {@code non-null;} source position
 * @param user {@code non-null;} address representing the instruction that
 * uses this instance
 * @param cases {@code non-null;} sorted list of switch cases (keys)
 * @param targets {@code non-null;} corresponding list of code addresses; the
 * branch target for each case
 */
public SwitchData(SourcePosition position, CodeAddress user,
                  IntList cases, CodeAddress[] targets) {
    super(position, RegisterSpecList.EMPTY);

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

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

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

    int sz = cases.size();

    if (sz != targets.length) {
        throw new IllegalArgumentException("cases / targets mismatch");
    }

    if (sz > 65535) {
        throw new IllegalArgumentException("too many cases");
    }

    this.user = user;
    this.cases = cases;
    this.targets = targets;
    this.packed = shouldPack(cases);
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:43,代码来源:SwitchData.java

示例13: packedCodeSize

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Gets the size of a packed table for the given cases, in 16-bit code
 * units.
 *
 * @param cases {@code non-null;} sorted list of cases
 * @return {@code >= -1;} the packed table size or {@code -1} if the
 * cases couldn't possibly be represented as a packed table
 */
private static long packedCodeSize(IntList cases) {
    int sz = cases.size();
    long low = cases.get(0);
    long high = cases.get(sz - 1);
    long result = ((high - low + 1)) * 2 + 4;

    return (result <= 0x7fffffff) ? result : -1;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:17,代码来源:SwitchData.java

示例14: indexListFromLabelList

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Builds an IntList of block indices from a basic block list and a list
 * of labels taken from Rop form.
 *
 * @param ropBlocks Rop blocks
 * @param labelList list of rop block labels
 * @return IntList of block indices
 */
public static IntList indexListFromLabelList(BasicBlockList ropBlocks,
        IntList labelList) {

    IntList result = new IntList(labelList.size());

    for (int i = 0, sz = labelList.size(); i < sz; i++) {
        result.add(ropBlocks.indexOfLabel(labelList.get(i)));
    }

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

示例15: SwitchList

import com.android.dx.util.IntList; //导入依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param size {@code >= 0;} the number of elements to be in the table
 */
public SwitchList(int size) {
    super(true);
    this.values = new IntList(size);
    this.targets = new IntList(size + 1);
    this.size = size;
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:12,代码来源:SwitchList.java


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