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

C2: RegMask::is_bound_set split set handling broken since JDK-8221404

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b27
    • Verification:
      Verified

      Description

      As I was adding a test and doing some micro-optimizations to RegMask::is_bound, I found a bug I introduced in JDK-8221404 where I mixed up the formula for how much we need to shift the "bit" when overflowing:

              // The lower (BitsPerWord - size) bits should be 1 since it is split case.
              uintptr_t set = (bit >> (BitsPerWord - bit_index)) - 1;

      This is completely wrong and needs to be fixed.

      There's also an optimization to be had by reworking the is_bound* methods to "short-circuit" after a bit, pair or set is found rather than keeping a state variable. is_bound1 is in even worse shape since it uses Size() (which does popcount on each word, which are relatively expensive). Getting these to a similar shape allows gcc to optimize is_bound to be roughly twice as fast.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: