code: public void removeEmptyBlocks() {
          Block curr = blocklistHead;
          Block prev = null;
          int effId = 0;
          while (curr != null) {
              if (!curr.isEmpty()) {
                  curr.id = effId++;
                  if (prev != null) {
                      prev.nextBlock = curr;
                  } else {
                      blocklistHead = curr;
                  }
                  prev = curr;
              }
              curr = curr.nextBlock;
          }
          if (prev != null) {
              prev.nextBlock = null;
          } else {
              blocklistHead = null;
          }
          numBlocks = effId;
      }
docs: Removes all blocks which are empty from the block list. The {@link Block#id IDs} of the blocks are adjusted to
  remain contiguous.
  <p>
  Note that this method does not modify the worklist, i.e., it should only be called when the worklist is empty.