Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8256883

C2: Add a RegMask iterator

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 16
    • 16
    • 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.

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

              Created:
              Updated:
              Resolved: