< prev index next >

src/share/vm/gc/g1/g1BiasedArray.hpp

Print this page




 111 
 112   // Set the element of the given array at the given index to the
 113   // given value. Assume the index is valid. This is a convenience
 114   // method that does sanity checking on the index.
 115   void set_by_index(idx_t index, T value) {
 116     verify_index(index);
 117     this->base()[index] = value;
 118   }
 119 
 120   // The raw biased base pointer.
 121   T* biased_base() const { return (T*)G1BiasedMappedArrayBase::_biased_base; }
 122 
 123   // Return the element of the given array that covers the given word in the
 124   // heap. Assumes the index is valid.
 125   T get_by_address(HeapWord* value) const {
 126     idx_t biased_index = ((uintptr_t)value) >> this->shift_by();
 127     this->verify_biased_index(biased_index);
 128     return biased_base()[biased_index];
 129   }
 130 








 131   // Set the value of the array entry that corresponds to the given array.
 132   void set_by_address(HeapWord * address, T value) {
 133     idx_t biased_index = ((uintptr_t)address) >> this->shift_by();
 134     this->verify_biased_index(biased_index);
 135     biased_base()[biased_index] = value;
 136   }
 137 
 138 protected:
 139   // Returns the address of the element the given address maps to
 140   T* address_mapped_to(HeapWord* address) {
 141     idx_t biased_index = ((uintptr_t)address) >> this->shift_by();
 142     this->verify_biased_index_inclusive_end(biased_index);
 143     return biased_base() + biased_index;
 144   }
 145 
 146 public:
 147   // Return the smallest address (inclusive) in the heap that this array covers.
 148   HeapWord* bottom_address_mapped() const {
 149     return (HeapWord*) ((uintptr_t)this->bias() << this->shift_by());
 150   }




 111 
 112   // Set the element of the given array at the given index to the
 113   // given value. Assume the index is valid. This is a convenience
 114   // method that does sanity checking on the index.
 115   void set_by_index(idx_t index, T value) {
 116     verify_index(index);
 117     this->base()[index] = value;
 118   }
 119 
 120   // The raw biased base pointer.
 121   T* biased_base() const { return (T*)G1BiasedMappedArrayBase::_biased_base; }
 122 
 123   // Return the element of the given array that covers the given word in the
 124   // heap. Assumes the index is valid.
 125   T get_by_address(HeapWord* value) const {
 126     idx_t biased_index = ((uintptr_t)value) >> this->shift_by();
 127     this->verify_biased_index(biased_index);
 128     return biased_base()[biased_index];
 129   }
 130 
 131   // Return as a uint the index of the element of the given array that 
 132   // covers the given word in the heap.
 133   uint get_index_by_address(HeapWord* value) const {
 134     idx_t biased_index = ((uintptr_t)value) >> this->shift_by();
 135     this->verify_biased_index(biased_index);
 136     return (uint)biased_index - (uint)_bias;
 137   }
 138 
 139   // Set the value of the array entry that corresponds to the given array.
 140   void set_by_address(HeapWord * address, T value) {
 141     idx_t biased_index = ((uintptr_t)address) >> this->shift_by();
 142     this->verify_biased_index(biased_index);
 143     biased_base()[biased_index] = value;
 144   }
 145 
 146 protected:
 147   // Returns the address of the element the given address maps to
 148   T* address_mapped_to(HeapWord* address) {
 149     idx_t biased_index = ((uintptr_t)address) >> this->shift_by();
 150     this->verify_biased_index_inclusive_end(biased_index);
 151     return biased_base() + biased_index;
 152   }
 153 
 154 public:
 155   // Return the smallest address (inclusive) in the heap that this array covers.
 156   HeapWord* bottom_address_mapped() const {
 157     return (HeapWord*) ((uintptr_t)this->bias() << this->shift_by());
 158   }


< prev index next >