src/share/vm/utilities/bitMap.hpp

Print this page




  63 
  64   // Return a mask that will select the specified bit, when applied to the word
  65   // containing the bit.
  66   static bm_word_t bit_mask(idx_t bit) { return (bm_word_t)1 << bit_in_word(bit); }
  67 
  68   // Return the index of the word containing the specified bit.
  69   static idx_t word_index(idx_t bit)  { return bit >> LogBitsPerWord; }
  70 
  71   // Return the bit number of the first bit in the specified word.
  72   static idx_t bit_index(idx_t word)  { return word << LogBitsPerWord; }
  73 
  74   // Return the array of bitmap words, or a specific word from it.
  75   bm_word_t* map() const           { return _map; }
  76   bm_word_t  map(idx_t word) const { return _map[word]; }
  77 
  78   // Return a pointer to the word containing the specified bit.
  79   bm_word_t* word_addr(idx_t bit) const { return map() + word_index(bit); }
  80 
  81   // Set a word to a specified value or to all ones; clear a word.
  82   void set_word  (idx_t word, bm_word_t val) { _map[word] = val; }
  83   void set_word  (idx_t word)            { set_word(word, ~(uintptr_t)0); }
  84   void clear_word(idx_t word)            { _map[word] = 0; }
  85 
  86   // Utilities for ranges of bits.  Ranges are half-open [beg, end).
  87 
  88   // Ranges within a single word.
  89   bm_word_t inverted_bit_mask_for_range(idx_t beg, idx_t end) const;
  90   void  set_range_within_word      (idx_t beg, idx_t end);
  91   void  clear_range_within_word    (idx_t beg, idx_t end);
  92   void  par_put_range_within_word  (idx_t beg, idx_t end, bool value);
  93 
  94   // Ranges spanning entire words.
  95   void      set_range_of_words         (idx_t beg, idx_t end);
  96   void      clear_range_of_words       (idx_t beg, idx_t end);
  97   void      set_large_range_of_words   (idx_t beg, idx_t end);
  98   void      clear_large_range_of_words (idx_t beg, idx_t end);
  99 
 100   // The index of the first full word in a range.
 101   idx_t word_index_round_up(idx_t bit) const;
 102 
 103   // Verification.




  63 
  64   // Return a mask that will select the specified bit, when applied to the word
  65   // containing the bit.
  66   static bm_word_t bit_mask(idx_t bit) { return (bm_word_t)1 << bit_in_word(bit); }
  67 
  68   // Return the index of the word containing the specified bit.
  69   static idx_t word_index(idx_t bit)  { return bit >> LogBitsPerWord; }
  70 
  71   // Return the bit number of the first bit in the specified word.
  72   static idx_t bit_index(idx_t word)  { return word << LogBitsPerWord; }
  73 
  74   // Return the array of bitmap words, or a specific word from it.
  75   bm_word_t* map() const           { return _map; }
  76   bm_word_t  map(idx_t word) const { return _map[word]; }
  77 
  78   // Return a pointer to the word containing the specified bit.
  79   bm_word_t* word_addr(idx_t bit) const { return map() + word_index(bit); }
  80 
  81   // Set a word to a specified value or to all ones; clear a word.
  82   void set_word  (idx_t word, bm_word_t val) { _map[word] = val; }
  83   void set_word  (idx_t word)            { set_word(word, ~(bm_word_t)0); }
  84   void clear_word(idx_t word)            { _map[word] = 0; }
  85 
  86   // Utilities for ranges of bits.  Ranges are half-open [beg, end).
  87 
  88   // Ranges within a single word.
  89   bm_word_t inverted_bit_mask_for_range(idx_t beg, idx_t end) const;
  90   void  set_range_within_word      (idx_t beg, idx_t end);
  91   void  clear_range_within_word    (idx_t beg, idx_t end);
  92   void  par_put_range_within_word  (idx_t beg, idx_t end, bool value);
  93 
  94   // Ranges spanning entire words.
  95   void      set_range_of_words         (idx_t beg, idx_t end);
  96   void      clear_range_of_words       (idx_t beg, idx_t end);
  97   void      set_large_range_of_words   (idx_t beg, idx_t end);
  98   void      clear_large_range_of_words (idx_t beg, idx_t end);
  99 
 100   // The index of the first full word in a range.
 101   idx_t word_index_round_up(idx_t bit) const;
 102 
 103   // Verification.