< prev index next >

src/share/vm/utilities/bitMap.hpp

Print this page




 172   static idx_t calc_size_in_words(size_t size_in_bits) {
 173     return word_index(size_in_bits + BitsPerWord - 1);
 174   }
 175 
 176   static idx_t calc_size_in_bytes(size_t size_in_bits) {
 177     return calc_size_in_words(size_in_bits) * BytesPerWord;
 178   }
 179 
 180   idx_t size() const          { return _size; }
 181   idx_t size_in_words() const { return calc_size_in_words(size()); }
 182   idx_t size_in_bytes() const { return calc_size_in_bytes(size()); }
 183 
 184   bool at(idx_t index) const {
 185     verify_index(index);
 186     return (*word_addr(index) & bit_mask(index)) != 0;
 187   }
 188 
 189   // Align bit index up or down to the next bitmap word boundary, or check
 190   // alignment.
 191   static idx_t word_align_up(idx_t bit) {
 192     return align_size_up(bit, BitsPerWord);
 193   }
 194   static idx_t word_align_down(idx_t bit) {
 195     return align_size_down(bit, BitsPerWord);
 196   }
 197   static bool is_word_aligned(idx_t bit) {
 198     return word_align_up(bit) == bit;
 199   }
 200 
 201   // Set or clear the specified bit.
 202   inline void set_bit(idx_t bit);
 203   inline void clear_bit(idx_t bit);
 204 
 205   // Atomically set or clear the specified bit.
 206   inline bool par_set_bit(idx_t bit);
 207   inline bool par_clear_bit(idx_t bit);
 208 
 209   // Put the given value at the given offset. The parallel version
 210   // will CAS the value into the bitmap and is quite a bit slower.
 211   // The parallel version also returns a value indicating if the
 212   // calling thread was the one that changed the value of the bit.
 213   void at_put(idx_t index, bool value);
 214   bool par_at_put(idx_t index, bool value);
 215 




 172   static idx_t calc_size_in_words(size_t size_in_bits) {
 173     return word_index(size_in_bits + BitsPerWord - 1);
 174   }
 175 
 176   static idx_t calc_size_in_bytes(size_t size_in_bits) {
 177     return calc_size_in_words(size_in_bits) * BytesPerWord;
 178   }
 179 
 180   idx_t size() const          { return _size; }
 181   idx_t size_in_words() const { return calc_size_in_words(size()); }
 182   idx_t size_in_bytes() const { return calc_size_in_bytes(size()); }
 183 
 184   bool at(idx_t index) const {
 185     verify_index(index);
 186     return (*word_addr(index) & bit_mask(index)) != 0;
 187   }
 188 
 189   // Align bit index up or down to the next bitmap word boundary, or check
 190   // alignment.
 191   static idx_t word_align_up(idx_t bit) {
 192     return align_up(bit, BitsPerWord);
 193   }
 194   static idx_t word_align_down(idx_t bit) {
 195     return align_down(bit, BitsPerWord);
 196   }
 197   static bool is_word_aligned(idx_t bit) {
 198     return word_align_up(bit) == bit;
 199   }
 200 
 201   // Set or clear the specified bit.
 202   inline void set_bit(idx_t bit);
 203   inline void clear_bit(idx_t bit);
 204 
 205   // Atomically set or clear the specified bit.
 206   inline bool par_set_bit(idx_t bit);
 207   inline bool par_clear_bit(idx_t bit);
 208 
 209   // Put the given value at the given offset. The parallel version
 210   // will CAS the value into the bitmap and is quite a bit slower.
 211   // The parallel version also returns a value indicating if the
 212   // calling thread was the one that changed the value of the bit.
 213   void at_put(idx_t index, bool value);
 214   bool par_at_put(idx_t index, bool value);
 215 


< prev index next >