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

BitMap::get_next_zero_offset may give wrong result on Mac

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • 9
    • hotspot
    • None
    • b21
    • generic
    • generic

      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.

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

              Created:
              Updated:
              Resolved: