C2: Add a RegMask iterator

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 16
    • Affects Version/s: 16
    • Component/s: hotspot
    • b26

      There are a few places around C2 where we inefficiently iterate over RegMasks:

        RegMask rm = n->out_RegMask();// Make local copy
        while( rm.is_NotEmpty() ) {
          OptoReg::Name kill = rm.find_first_elem();
          rm.Remove(kill);
          verify_do_def( n, kill, msg );
        }

      This copies a RegMask, then find_first_elem + remove in a loop until all registers have been found. find_first_elem is O(n), so this is accidentally quadratic.

      By implementing a simple RegMaskIterator we can speed this up and possibly make the code a bit clearer by doing so.

            Assignee:
            Claes Redestad
            Reporter:
            Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: