Java Code Examples for com.android.dx.rop.code.BasicBlock#Visitor

The following examples show how to use com.android.dx.rop.code.BasicBlock#Visitor . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Ropper.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example 2
Source File: Ropper.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example 3
Source File: Ropper.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example 4
Source File: Ropper.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example 5
Source File: Ropper.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Visits each non-subroutine block once in depth-first successor order.
 *
 * @param firstLabel label of start block
 * @param v callback interface
 */
private void forEachNonSubBlockDepthFirst(int firstLabel,
        BasicBlock.Visitor v) {
    forEachNonSubBlockDepthFirst0(labelToBlock(firstLabel),
            v, new BitSet(maxLabel));
}
 
Example 6
Source File: Ropper.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Visits each non-subroutine block once in depth-first successor order.
 *
 * @param firstLabel label of start block
 * @param v callback interface
 */
private void forEachNonSubBlockDepthFirst(int firstLabel,
        BasicBlock.Visitor v) {
    forEachNonSubBlockDepthFirst0(labelToBlock(firstLabel),
            v, new BitSet(maxLabel));
}
 
Example 7
Source File: Ropper.java    From J2ME-Loader with Apache License 2.0 2 votes vote down vote up
/**
 * Visits each non-subroutine block once in depth-first successor order.
 *
 * @param firstLabel label of start block
 * @param v callback interface
 */
private void forEachNonSubBlockDepthFirst(int firstLabel,
        BasicBlock.Visitor v) {
    forEachNonSubBlockDepthFirst0(labelToBlock(firstLabel),
            v, new BitSet(maxLabel));
}
 
Example 8
Source File: Ropper.java    From buck with Apache License 2.0 2 votes vote down vote up
/**
 * Visits each non-subroutine block once in depth-first successor order.
 *
 * @param firstLabel label of start block
 * @param v callback interface
 */
private void forEachNonSubBlockDepthFirst(int firstLabel,
        BasicBlock.Visitor v) {
    forEachNonSubBlockDepthFirst0(labelToBlock(firstLabel),
            v, new BitSet(maxLabel));
}