Java Code Examples for com.android.dx.util.Bits#clear()

The following examples show how to use com.android.dx.util.Bits#clear() . 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: BytecodeArray.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the given "work set" by repeatedly finding the lowest bit
 * in the set, clearing it, and parsing and visiting the instruction at
 * the indicated offset (that is, the bit index), repeating until the
 * work set is empty. It is expected that the visitor will regularly
 * set new bits in the work set during the process.
 *
 * @param workSet {@code non-null;} the work set to process
 * @param visitor {@code non-null;} visitor to call back to for
 * each instruction
 */
public void processWorkSet(int[] workSet, Visitor visitor) {
    if (visitor == null) {
        throw new NullPointerException("visitor == null");
    }

    for (;;) {
        int offset = Bits.findFirst(workSet, 0);
        if (offset < 0) {
            break;
        }
        Bits.clear(workSet, offset);
        parseInstruction(offset, visitor);
        visitor.setPreviousOffset(offset);
    }
}
 
Example 2
Source File: BytecodeArray.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the given "work set" by repeatedly finding the lowest bit
 * in the set, clearing it, and parsing and visiting the instruction at
 * the indicated offset (that is, the bit index), repeating until the
 * work set is empty. It is expected that the visitor will regularly
 * set new bits in the work set during the process.
 *
 * @param workSet {@code non-null;} the work set to process
 * @param visitor {@code non-null;} visitor to call back to for
 * each instruction
 */
public void processWorkSet(int[] workSet, Visitor visitor) {
    if (visitor == null) {
        throw new NullPointerException("visitor == null");
    }

    for (;;) {
        int offset = Bits.findFirst(workSet, 0);
        if (offset < 0) {
            break;
        }
        Bits.clear(workSet, offset);
        parseInstruction(offset, visitor);
        visitor.setPreviousOffset(offset);
    }
}
 
Example 3
Source File: BytecodeArray.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the given "work set" by repeatedly finding the lowest bit
 * in the set, clearing it, and parsing and visiting the instruction at
 * the indicated offset (that is, the bit index), repeating until the
 * work set is empty. It is expected that the visitor will regularly
 * set new bits in the work set during the process.
 *
 * @param workSet {@code non-null;} the work set to process
 * @param visitor {@code non-null;} visitor to call back to for
 * each instruction
 */
public void processWorkSet(int[] workSet, Visitor visitor) {
    if (visitor == null) {
        throw new NullPointerException("visitor == null");
    }

    for (;;) {
        int offset = Bits.findFirst(workSet, 0);
        if (offset < 0) {
            break;
        }
        Bits.clear(workSet, offset);
        parseInstruction(offset, visitor);
        visitor.setPreviousOffset(offset);
    }
}
 
Example 4
Source File: BytecodeArray.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the given "work set" by repeatedly finding the lowest bit
 * in the set, clearing it, and parsing and visiting the instruction at
 * the indicated offset (that is, the bit index), repeating until the
 * work set is empty. It is expected that the visitor will regularly
 * set new bits in the work set during the process.
 *
 * @param workSet {@code non-null;} the work set to process
 * @param visitor {@code non-null;} visitor to call back to for
 * each instruction
 */
public void processWorkSet(int[] workSet, Visitor visitor) {
    if (visitor == null) {
        throw new NullPointerException("visitor == null");
    }

    for (;;) {
        int offset = Bits.findFirst(workSet, 0);
        if (offset < 0) {
            break;
        }
        Bits.clear(workSet, offset);
        parseInstruction(offset, visitor);
        visitor.setPreviousOffset(offset);
    }
}
 
Example 5
Source File: Ropper.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Does the conversion.
 */
private void doit() {
    int[] workSet = Bits.makeBitSet(maxLabel);

    Bits.set(workSet, 0);
    addSetupBlocks();
    setFirstFrame();

    for (;;) {
        int offset = Bits.findFirst(workSet, 0);
        if (offset < 0) {
            break;
        }
        Bits.clear(workSet, offset);
        ByteBlock block = blocks.labelToBlock(offset);
        Frame frame = startFrames[offset];
        try {
            processBlock(block, frame, workSet);
        } catch (SimException ex) {
            ex.addContext("...while working on block " + Hex.u2(offset));
            throw ex;
        }
    }

    addReturnBlock();
    addSynchExceptionHandlerBlock();
    addExceptionSetupBlocks();

    if (hasSubroutines) {
        // Subroutines are very rare, so skip this step if it's n/a
        inlineSubroutines();
    }
}
 
Example 6
Source File: LocalVariableExtractor.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Does the extraction.
 *
 * @return {@code non-null;} the extracted information
 */
private LocalVariableInfo doit() {
    for (int label = method.getFirstLabel();
         label >= 0;
         label = Bits.findFirst(workSet, 0)) {
        Bits.clear(workSet, label);
        processBlock(label);
    }

    resultInfo.setImmutable();
    return resultInfo;
}
 
Example 7
Source File: Ropper.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Does the conversion.
 */
private void doit() {
    int[] workSet = Bits.makeBitSet(maxLabel);

    Bits.set(workSet, 0);
    addSetupBlocks();
    setFirstFrame();

    for (;;) {
        int offset = Bits.findFirst(workSet, 0);
        if (offset < 0) {
            break;
        }
        Bits.clear(workSet, offset);
        ByteBlock block = blocks.labelToBlock(offset);
        Frame frame = startFrames[offset];
        try {
            processBlock(block, frame, workSet);
        } catch (SimException ex) {
            ex.addContext("...while working on block " + Hex.u2(offset));
            throw ex;
        }
    }

    addReturnBlock();
    addSynchExceptionHandlerBlock();
    addExceptionSetupBlocks();

    if (hasSubroutines) {
        // Subroutines are very rare, so skip this step if it's n/a
        inlineSubroutines();
    }
}
 
Example 8
Source File: LocalVariableExtractor.java    From Box with Apache License 2.0 5 votes vote down vote up
/**
 * Does the extraction.
 *
 * @return {@code non-null;} the extracted information
 */
private LocalVariableInfo doit() {
    for (int label = method.getFirstLabel();
         label >= 0;
         label = Bits.findFirst(workSet, 0)) {
        Bits.clear(workSet, label);
        processBlock(label);
    }

    resultInfo.setImmutable();
    return resultInfo;
}
 
Example 9
Source File: Ropper.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Does the conversion.
 */
private void doit() {
    int[] workSet = Bits.makeBitSet(maxLabel);

    Bits.set(workSet, 0);
    addSetupBlocks();
    setFirstFrame();

    for (;;) {
        int offset = Bits.findFirst(workSet, 0);
        if (offset < 0) {
            break;
        }
        Bits.clear(workSet, offset);
        ByteBlock block = blocks.labelToBlock(offset);
        Frame frame = startFrames[offset];
        try {
            processBlock(block, frame, workSet);
        } catch (SimException ex) {
            ex.addContext("...while working on block " + Hex.u2(offset));
            throw ex;
        }
    }

    addReturnBlock();
    addSynchExceptionHandlerBlock();
    addExceptionSetupBlocks();

    if (hasSubroutines) {
        // Subroutines are very rare, so skip this step if it's n/a
        inlineSubroutines();
    }
}
 
Example 10
Source File: LocalVariableExtractor.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/**
 * Does the extraction.
 *
 * @return {@code non-null;} the extracted information
 */
private LocalVariableInfo doit() {
    for (int label = method.getFirstLabel();
         label >= 0;
         label = Bits.findFirst(workSet, 0)) {
        Bits.clear(workSet, label);
        processBlock(label);
    }

    resultInfo.setImmutable();
    return resultInfo;
}
 
Example 11
Source File: Ropper.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Does the conversion.
 */
private void doit() {
    int[] workSet = Bits.makeBitSet(maxLabel);

    Bits.set(workSet, 0);
    addSetupBlocks();
    setFirstFrame();

    for (;;) {
        int offset = Bits.findFirst(workSet, 0);
        if (offset < 0) {
            break;
        }
        Bits.clear(workSet, offset);
        ByteBlock block = blocks.labelToBlock(offset);
        Frame frame = startFrames[offset];
        try {
            processBlock(block, frame, workSet);
        } catch (SimException ex) {
            ex.addContext("...while working on block " + Hex.u2(offset));
            throw ex;
        }
    }

    addReturnBlock();
    addSynchExceptionHandlerBlock();
    addExceptionSetupBlocks();

    if (hasSubroutines) {
        // Subroutines are very rare, so skip this step if it's n/a
        inlineSubroutines();
    }
}
 
Example 12
Source File: LocalVariableExtractor.java    From buck with Apache License 2.0 5 votes vote down vote up
/**
 * Does the extraction.
 *
 * @return {@code non-null;} the extracted information
 */
private LocalVariableInfo doit() {
    for (int label = method.getFirstLabel();
         label >= 0;
         label = Bits.findFirst(workSet, 0)) {
        Bits.clear(workSet, label);
        processBlock(label);
    }

    resultInfo.setImmutable();
    return resultInfo;
}