175 return (HeapWord*) ((uintptr_t)this->bias() << this->shift_by());
176 }
177
178 // Return the highest address (exclusive) in the heap that this array covers.
179 HeapWord* end_address_mapped() const {
180 return (HeapWord*) ((uintptr_t)(this->bias() + this->length()) << this->shift_by());
181 }
182
183 protected:
184 virtual T default_value() const = 0;
185 // Set all elements of the given array to the given value.
186 void clear() {
187 T value = default_value();
188 for (idx_t i = 0; i < length(); i++) {
189 set_by_index(i, value);
190 }
191 }
192 public:
193 G1BiasedMappedArray() {}
194
195 // Allocate and initialize this array to cover the heap addresses in the range
196 // of [bottom, end).
197 void initialize(HeapWord* bottom, HeapWord* end, size_t mapping_granularity) {
198 G1BiasedMappedArrayBase::initialize(bottom, end, sizeof(T), mapping_granularity);
199 this->clear();
200 }
201 };
202
203 #endif // SHARE_GC_G1_G1BIASEDARRAY_HPP
|
175 return (HeapWord*) ((uintptr_t)this->bias() << this->shift_by());
176 }
177
178 // Return the highest address (exclusive) in the heap that this array covers.
179 HeapWord* end_address_mapped() const {
180 return (HeapWord*) ((uintptr_t)(this->bias() + this->length()) << this->shift_by());
181 }
182
183 protected:
184 virtual T default_value() const = 0;
185 // Set all elements of the given array to the given value.
186 void clear() {
187 T value = default_value();
188 for (idx_t i = 0; i < length(); i++) {
189 set_by_index(i, value);
190 }
191 }
192 public:
193 G1BiasedMappedArray() {}
194
195 // Allocate and initialize this array to cover the heap addresses in the given MemRegion.
196 void initialize(MemRegion region, size_t mapping_granularity) {
197 G1BiasedMappedArrayBase::initialize(region.start(), region.end(), sizeof(T), mapping_granularity);
198 this->clear();
199 }
200 };
201
202 #endif // SHARE_GC_G1_G1BIASEDARRAY_HPP
|