Java Code Examples for com.android.dx.util.IntList#sort()

The following examples show how to use com.android.dx.util.IntList#sort() . 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 6 votes vote down vote up
/**
 * 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() {

        @Override
        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);
        }
    }
}
 
Example 2
Source File: Ropper.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * 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() {

        @Override
        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);
        }
    }
}
 
Example 3
Source File: Ropper.java    From J2ME-Loader with Apache License 2.0 6 votes vote down vote up
/**
  * 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() {

         @Override
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);
         }
     }
 }
 
Example 4
Source File: Ropper.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
        }
    }
}