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


Java IntList.get方法代码示例

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


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

示例1: 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

示例2: removeBlockAndSpecialSuccessors

import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
 * Helper for {@link #addOrReplaceBlock} which recursively removes
 * the given block and all blocks that are (direct and indirect)
 * successors of it whose labels indicate that they are not in the
 * normally-translated range.
 *
 * @param idx {@code non-null;} block to remove (etc.)
 */
private void removeBlockAndSpecialSuccessors(int idx) {
    int minLabel = getMinimumUnreservedLabel();
    BasicBlock block = result.get(idx);
    IntList successors = block.getSuccessors();
    int sz = successors.size();

    result.remove(idx);
    resultSubroutines.remove(idx);

    for (int i = 0; i < sz; i++) {
        int label = successors.get(i);
        if (label >= minLabel) {
            idx = labelToResultIndex(label);
            if (idx < 0) {
                throw new RuntimeException("Invalid label "
                        + Hex.u2(label));
            }
            removeBlockAndSpecialSuccessors(idx);
        }
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:30,代码来源:Ropper.java

示例3: 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

示例4: 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

示例5: forEachNonSubBlockDepthFirst0

import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
 * Visits each block once in depth-first successor order, ignoring
 * {@code jsr} targets. Worker for {@link #forEachNonSubBlockDepthFirst}.
 *
 * @param next next block to visit
 * @param v callback interface
 * @param visited set of blocks already visited
 */
private void forEachNonSubBlockDepthFirst0(
        BasicBlock next, BasicBlock.Visitor v, BitSet visited) {
    v.visitBlock(next);
    visited.set(next.getLabel());

    IntList successors = next.getSuccessors();
    int sz = successors.size();

    for (int i = 0; i < sz; i++) {
        int succ = successors.get(i);

        if (visited.get(succ)) {
            continue;
        }

        if (isSubroutineCaller(next) && i > 0) {
            // ignore jsr targets
            continue;
        }

        /*
         * Ignore missing labels: they're successors of
         * subroutines that never invoke a ret.
         */
        int idx = labelToResultIndex(succ);
        if (idx >= 0) {
            forEachNonSubBlockDepthFirst0(result.get(idx), v, visited);
        }
    }
}
 
开发者ID:JLLK,项目名称:multidex-maker,代码行数:39,代码来源:Ropper.java

示例6: ByteBlock

import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
 * Constructs an instance.
 *
 * @param label {@code >= 0;} target label for this block
 * @param start {@code >= 0;} bytecode offset (inclusive) of the start
 * of the block
 * @param end {@code > start;} bytecode offset (exclusive) of the end
 * of the block
 * @param successors {@code non-null;} list of successors that this block may
 * branch to
 * @param catches {@code non-null;} list of exceptions caught and their
 * handler targets
 */
public ByteBlock(int label, int start, int end, IntList successors,
                 ByteCatchList catches) {
    if (label < 0) {
        throw new IllegalArgumentException("label < 0");
    }

    if (start < 0) {
        throw new IllegalArgumentException("start < 0");
    }

    if (end <= start) {
        throw new IllegalArgumentException("end <= start");
    }

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

    int sz = successors.size();
    for (int i = 0; i < sz; i++) {
        if (successors.get(i) < 0) {
            throw new IllegalArgumentException("successors[" + i +
                                               "] == " +
                                               successors.get(i));
        }
    }

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

    this.label = label;
    this.start = start;
    this.end = end;
    this.successors = successors;
    this.catches = catches;
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:51,代码来源:ByteBlock.java

示例7: isSubroutineCaller

import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
 * Checks to see if the basic block is a subroutine caller block.
 *
 * @param bb {@code non-null;} the basic block in question
 * @return true if this block calls a subroutine
 */
private boolean isSubroutineCaller(BasicBlock bb) {
    IntList successors = bb.getSuccessors();
    if (successors.size() < 2) return false;

    int subLabel = successors.get(1);

    return (subLabel < subroutines.length)
            && (subroutines[subLabel] != null);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:16,代码来源:Ropper.java

示例8: process

import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
 * Runs algorithm. TODO: This is n^2, and could be made linear-ish with
 * a hash. In particular, hash the contents of each block and only
 * compare blocks with the same hash.
 *
 * @return {@code non-null;} new method that has been processed
 */
public RopMethod process() {
    int szBlocks = blocks.size();
    // indexed by label
    BitSet toDelete = new BitSet(blocks.getMaxLabel());

    // For each non-deleted block...
    for (int bindex = 0; bindex < szBlocks; bindex++) {
        BasicBlock b = blocks.get(bindex);

        if (toDelete.get(b.getLabel())) {
            // doomed block
            continue;
        }

        IntList preds = ropMethod.labelToPredecessors(b.getLabel());

        // ...look at all of it's predecessors that have only one succ...
        int szPreds = preds.size();
        for (int i = 0; i < szPreds; i++) {
            int iLabel = preds.get(i);

            BasicBlock iBlock = blocks.labelToBlock(iLabel);

            if (toDelete.get(iLabel)
                    || iBlock.getSuccessors().size() > 1
                    || iBlock.getFirstInsn().getOpcode().getOpcode() ==
                        RegOps.MOVE_RESULT) {
                continue;
            }

            IntList toCombine = new IntList();

            // ...and see if they can be combined with any other preds...
            for (int j = i + 1; j < szPreds; j++) {
                int jLabel = preds.get(j);
                BasicBlock jBlock = blocks.labelToBlock(jLabel);

                if (jBlock.getSuccessors().size() == 1
                        && compareInsns(iBlock, jBlock)) {

                    toCombine.add(jLabel);
                    toDelete.set(jLabel);
                }
            }

            combineBlocks(iLabel, toCombine);
        }
    }

    for (int i = szBlocks - 1; i >= 0; i--) {
        if (toDelete.get(newBlocks.get(i).getLabel())) {
            newBlocks.set(i, null);
        }
    }

    newBlocks.shrinkToFit();
    newBlocks.setImmutable();

    return new RopMethod(newBlocks, ropMethod.getFirstLabel());
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:68,代码来源:IdenticalBlockCombiner.java

示例9: catchesEqual

import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
 * Compares the catches of two blocks for equality. This includes
 * both the catch types and target labels.
 *
 * @param block1 {@code non-null;} one block to compare
 * @param block2 {@code non-null;} the other block to compare
 * @return {@code true} if the two blocks' non-primary successors
 * are identical
 */
public boolean catchesEqual(BasicBlock block1, BasicBlock block2) {
    TypeList catches1 = block1.getExceptionHandlerTypes();
    TypeList catches2 = block2.getExceptionHandlerTypes();

    if (!StdTypeList.equalContents(catches1, catches2)) {
        return false;
    }

    IntList succ1 = block1.getSuccessors();
    IntList succ2 = block2.getSuccessors();
    int size = succ1.size(); // Both are guaranteed to be the same size.

    int primary1 = block1.getPrimarySuccessor();
    int primary2 = block2.getPrimarySuccessor();

    if (((primary1 == -1) || (primary2 == -1))
            && (primary1 != primary2)) {
        /*
         * For the current purpose, both blocks in question must
         * either both have a primary or both not have a primary to
         * be considered equal, and it turns out here that that's not
         * the case.
         */
        return false;
    }

    for (int i = 0; i < size; i++) {
        int label1 = succ1.get(i);
        int label2 = succ2.get(i);

        if (label1 == primary1) {
            /*
             * It should be the case that block2's primary is at the
             * same index. If not, we consider the blocks unequal for
             * the current purpose.
             */
            if (label2 != primary2) {
                return false;
            }
            continue;
        }

        if (label1 != label2) {
            return false;
        }
    }

    return true;
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:59,代码来源:BasicBlockList.java

示例10: ropDump

import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
 * Does a registerizing dump.
 *
 * @param meth {@code non-null;} method data to dump
 */
private void ropDump(ConcreteMethod meth) {
    TranslationAdvice advice = DexTranslationAdvice.THE_ONE;
    BytecodeArray code = meth.getCode();
    ByteArray bytes = code.getBytes();
    RopMethod rmeth = Ropper.convert(meth, advice, classFile.getMethods());
    StringBuffer sb = new StringBuffer(2000);

    if (optimize) {
        boolean isStatic = AccessFlags.isStatic(meth.getAccessFlags());
        int paramWidth = computeParamWidth(meth, isStatic);
        rmeth =
            Optimizer.optimize(rmeth, paramWidth, isStatic, true, advice);
    }

    BasicBlockList blocks = rmeth.getBlocks();
    int[] order = blocks.getLabelsInOrder();

    sb.append("first " + Hex.u2(rmeth.getFirstLabel()) + "\n");

    for (int label : order) {
        BasicBlock bb = blocks.get(blocks.indexOfLabel(label));
        sb.append("block ");
        sb.append(Hex.u2(label));
        sb.append("\n");

        IntList preds = rmeth.labelToPredecessors(label);
        int psz = preds.size();
        for (int i = 0; i < psz; i++) {
            sb.append("  pred ");
            sb.append(Hex.u2(preds.get(i)));
            sb.append("\n");
        }

        InsnList il = bb.getInsns();
        int ilsz = il.size();
        for (int i = 0; i < ilsz; i++) {
            Insn one = il.get(i);
            sb.append("  ");
            sb.append(il.get(i).toHuman());
            sb.append("\n");
        }

        IntList successors = bb.getSuccessors();
        int ssz = successors.size();
        if (ssz == 0) {
            sb.append("  returns\n");
        } else {
            int primary = bb.getPrimarySuccessor();
            for (int i = 0; i < ssz; i++) {
                int succ = successors.get(i);
                sb.append("  next ");
                sb.append(Hex.u2(succ));

                if ((ssz != 1) && (succ == primary)) {
                    sb.append(" *");
                }

                sb.append("\n");
            }
        }
    }

    suppressDump = false;
    setAt(bytes, 0);
    parsed(bytes, 0, bytes.size(), sb.toString());
    suppressDump = true;
}
 
开发者ID:johnlee175,项目名称:dex,代码行数:73,代码来源:BlockDumper.java

示例11: mergeWithSubroutineCaller

import com.android.dx.util.IntList; //导入方法依赖的package包/类
/**
 * Merges this frame with the frame of a subroutine caller at
 * {@code predLabel}. Only called on the frame at the first
 * block of a subroutine.
 *
 * @param other {@code non-null;} another frame
 * @param subLabel label of subroutine start block
 * @param predLabel label of calling block
 * @return {@code non-null;} the result of merging the two frames
 */
public Frame mergeWithSubroutineCaller(Frame other, int subLabel,
        int predLabel) {
    LocalsArray resultLocals;
    ExecutionStack resultStack;

    resultLocals = getLocals().mergeWithSubroutineCaller(
            other.getLocals(), predLabel);
    resultStack = getStack().merge(other.getStack());

    IntList newOtherSubroutines = other.subroutines.mutableCopy();
    newOtherSubroutines.add(subLabel);
    newOtherSubroutines.setImmutable();

    if ((resultLocals == getLocals())
            && (resultStack == getStack())
            && subroutines.equals(newOtherSubroutines)) {
        return this;
    }

    IntList resultSubroutines;

    if (subroutines.equals(newOtherSubroutines)) {
        resultSubroutines = subroutines;
    } else {
        /*
         * The new subroutines list should be the deepest of the two
         * lists being merged, but the postfix of the resultant list
         * must be equal to the shorter list.
         */
        IntList nonResultSubroutines;

        if (subroutines.size() > newOtherSubroutines.size()) {
            resultSubroutines = subroutines;
            nonResultSubroutines = newOtherSubroutines;
        } else {
            resultSubroutines = newOtherSubroutines;
            nonResultSubroutines = subroutines;
        }

        int szResult = resultSubroutines.size();
        int szNonResult = nonResultSubroutines.size();

        for (int i = szNonResult - 1; i >=0; i-- ) {
            if (nonResultSubroutines.get(i)
                    != resultSubroutines.get(
                    i + (szResult - szNonResult))) {
                throw new
                        RuntimeException("Incompatible merged subroutines");
            }
        }

    }

    return new Frame(resultLocals, resultStack, resultSubroutines);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:66,代码来源:Frame.java


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