< prev index next >

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

Print this page
rev 8461 : imported patch webrev1.patch
rev 8462 : [mq]: version3

*** 126,150 **** idx_t biased_index = ((uintptr_t)value) >> this->shift_by(); this->verify_biased_index(biased_index); return biased_base()[biased_index]; } ! // Return as a uint the index of the element of the given array that ! // covers the given word in the heap. ! uint get_index_by_address(HeapWord* value) const { idx_t biased_index = ((uintptr_t)value) >> this->shift_by(); this->verify_biased_index(biased_index); ! return (uint)biased_index - (uint)_bias; } // Set the value of the array entry that corresponds to the given array. void set_by_address(HeapWord * address, T value) { idx_t biased_index = ((uintptr_t)address) >> this->shift_by(); this->verify_biased_index(biased_index); biased_base()[biased_index] = value; } protected: // Returns the address of the element the given address maps to T* address_mapped_to(HeapWord* address) { idx_t biased_index = ((uintptr_t)address) >> this->shift_by(); this->verify_biased_index_inclusive_end(biased_index); --- 126,162 ---- idx_t biased_index = ((uintptr_t)value) >> this->shift_by(); this->verify_biased_index(biased_index); return biased_base()[biased_index]; } ! // Return the index of the element of the given array that covers the given ! // word in the heap. ! idx_t get_index_by_address(HeapWord* value) const { idx_t biased_index = ((uintptr_t)value) >> this->shift_by(); this->verify_biased_index(biased_index); ! return biased_index - _bias; } // Set the value of the array entry that corresponds to the given array. void set_by_address(HeapWord * address, T value) { idx_t biased_index = ((uintptr_t)address) >> this->shift_by(); this->verify_biased_index(biased_index); biased_base()[biased_index] = value; } + // Set the value of all array entries that correspond to addresses + // in the specified MemRegion. + void set_by_address(MemRegion range, T value) { + idx_t biased_start = ((uintptr_t)range.start()) >> this->shift_by(); + idx_t biased_last = ((uintptr_t)range.last()) >> this->shift_by(); + this->verify_biased_index(biased_start); + this->verify_biased_index(biased_last); + for (idx_t i = biased_start; i <= biased_last; i++) { + biased_base()[i] = value; + } + } + protected: // Returns the address of the element the given address maps to T* address_mapped_to(HeapWord* address) { idx_t biased_index = ((uintptr_t)address) >> this->shift_by(); this->verify_biased_index_inclusive_end(biased_index);
< prev index next >