src/hotspot/share/utilities/bitMap.cpp
changeset 59252 623722a6aeb9
parent 57561 1fec2d70fa13
equal deleted inserted replaced
59251:4cbfa5077d68 59252:623722a6aeb9
   215     bm_word_t* pw = word_addr(beg);
   215     bm_word_t* pw = word_addr(beg);
   216     bm_word_t  w  = *pw;
   216     bm_word_t  w  = *pw;
   217     bm_word_t  mr = inverted_bit_mask_for_range(beg, end);
   217     bm_word_t  mr = inverted_bit_mask_for_range(beg, end);
   218     bm_word_t  nw = value ? (w | ~mr) : (w & mr);
   218     bm_word_t  nw = value ? (w | ~mr) : (w & mr);
   219     while (true) {
   219     while (true) {
   220       bm_word_t res = Atomic::cmpxchg(nw, pw, w);
   220       bm_word_t res = Atomic::cmpxchg(pw, w, nw);
   221       if (res == w) break;
   221       if (res == w) break;
   222       w  = res;
   222       w  = res;
   223       nw = value ? (w | ~mr) : (w & mr);
   223       nw = value ? (w | ~mr) : (w & mr);
   224     }
   224     }
   225   }
   225   }
   638     BitMap::idx_t *table = NEW_C_HEAP_ARRAY(idx_t, 256, mtInternal);
   638     BitMap::idx_t *table = NEW_C_HEAP_ARRAY(idx_t, 256, mtInternal);
   639     for (uint i = 0; i < 256; i++) {
   639     for (uint i = 0; i < 256; i++) {
   640       table[i] = num_set_bits(i);
   640       table[i] = num_set_bits(i);
   641     }
   641     }
   642 
   642 
   643     if (!Atomic::replace_if_null(table, &_pop_count_table)) {
   643     if (!Atomic::replace_if_null(&_pop_count_table, table)) {
   644       guarantee(_pop_count_table != NULL, "invariant");
   644       guarantee(_pop_count_table != NULL, "invariant");
   645       FREE_C_HEAP_ARRAY(idx_t, table);
   645       FREE_C_HEAP_ARRAY(idx_t, table);
   646     }
   646     }
   647   }
   647   }
   648 }
   648 }