public static int computeFrameDepth(ControlFrame frame) {
    { int depth = 0;
      ControlFrame cursor = ((((QueryIterator)(Logic.$QUERYITERATOR$.get())) != null) ? ((QueryIterator)(Logic.$QUERYITERATOR$.get())).baseControlFrame : ((ControlFrame)(null)));

      loop000 : while (cursor != null) {
        if (cursor == frame) {
          break loop000;
        }
        cursor = cursor.down;
        depth = depth + 1;
      }
      if (cursor == frame) {
        return (depth);
      }
      else {
        return (Stella.NULL_INTEGER);
      }
    }
  }