예제 #1
0
파일: CFG.java 프로젝트: christ66/findbugs
    private void findNext() {
      while (next == null) {
        // Make sure we have an instruction iterator
        if (instructionIter == null) {
          if (!blockIter.hasNext()) {
            return; // At end
          }
          curBlock = blockIter.next();
          instructionIter = curBlock.instructionIterator();
        }

        if (instructionIter.hasNext()) {
          next = new Location(instructionIter.next(), curBlock);
        } else {
          instructionIter = null; // Go to next block
        }
      }
    }
예제 #2
0
파일: CFG.java 프로젝트: christ66/findbugs
 public void checkIntegrity() {
   // Ensure that basic blocks have only consecutive instructions
   for (Iterator<BasicBlock> i = blockIterator(); i.hasNext(); ) {
     BasicBlock basicBlock = i.next();
     InstructionHandle prev = null;
     for (Iterator<InstructionHandle> j = basicBlock.instructionIterator(); j.hasNext(); ) {
       InstructionHandle handle = j.next();
       if (prev != null && prev.getNext() != handle) {
         throw new IllegalStateException(
             "Non-consecutive instructions in block "
                 + basicBlock.getLabel()
                 + ": prev="
                 + prev
                 + ", handle="
                 + handle);
       }
       prev = handle;
     }
   }
 }