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.