--- a/hotspot/src/share/vm/gc/g1/g1BiasedArray.hpp Fri Jun 12 17:29:14 2015 -0400
+++ b/hotspot/src/share/vm/gc/g1/g1BiasedArray.hpp Fri Jun 12 19:49:54 2015 -0400
@@ -128,6 +128,14 @@
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();
@@ -135,6 +143,18 @@
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) {