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

BitMap::get_next_zero_offset may give wrong result on Mac

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 10
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b21
    • CPU:
      generic
    • OS:
      generic

      Description

      A call to get_next_zero_offset with a constant 0 start index may return the wrong result on Macs. This is because in the statement

        bm_word_t res = (map(index) >> pos) | left_n_bits((int)pos);

      the left_n_bits expression gets "miscompiled" due to JDK-8178348.

      One solution is to fix JDK-8178348. However, a better solution to the BitMap problem is to eliminate the use of left_n_bits. It is being used to replace the high order zeros shifted in by the ">> pos", to avoid confusing the following search for the first zero in res. But a different (and better) approach would be to change that to

        bm_word_t res = ~map(index) >> pos;

      and search for the first one in res.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kbarrett Kim Barrett
                Reporter:
                kbarrett Kim Barrett
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: