private static void debugVerify0(LocalList locals) {
    int sz = locals.size();
    Entry[] active = new Entry[65536];

    for (int i = 0; i < sz; i++) {
      Entry e = locals.get(i);
      int reg = e.getRegister();

      if (e.isStart()) {
        Entry already = active[reg];

        if ((already != null) && e.matches(already)) {
          throw new RuntimeException(
              "redundant start at "
                  + Integer.toHexString(e.getAddress())
                  + ": got "
                  + e
                  + "; had "
                  + already);
        }

        active[reg] = e;
      } else {
        if (active[reg] == null) {
          throw new RuntimeException("redundant end at " + Integer.toHexString(e.getAddress()));
        }

        int addr = e.getAddress();
        boolean foundStart = false;

        for (int j = i + 1; j < sz; j++) {
          Entry test = locals.get(j);
          if (test.getAddress() != addr) {
            break;
          }
          if (test.getRegisterSpec().getReg() == reg) {
            if (test.isStart()) {
              if (e.getDisposition() != Disposition.END_REPLACED) {
                throw new RuntimeException("improperly marked end at " + Integer.toHexString(addr));
              }
              foundStart = true;
            } else {
              throw new RuntimeException("redundant end at " + Integer.toHexString(addr));
            }
          }
        }

        if (!foundStart && (e.getDisposition() == Disposition.END_REPLACED)) {
          throw new RuntimeException(
              "improper end replacement claim at " + Integer.toHexString(addr));
        }

        active[reg] = null;
      }
    }
  }
Helper for {@link #debugVerify} which does most of the work.
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/code/LocalList.java