< prev index next >

src/hotspot/share/gc/shared/cardTable.hpp

Print this page

171   }
172 
173   virtual void invalidate(MemRegion mr);
174   void clear(MemRegion mr);
175   void dirty(MemRegion mr);
176 
177   // Provide read-only access to the card table array.
178   const CardValue* byte_for_const(const void* p) const {
179     return byte_for(p);
180   }
181   const CardValue* byte_after_const(const void* p) const {
182     return byte_after(p);
183   }
184 
185   // Mapping from card marking array entry to address of first word
186   HeapWord* addr_for(const CardValue* p) const {
187     assert(p >= _byte_map && p < _byte_map + _byte_map_size,
188            "out of bounds access to card marking array. p: " PTR_FORMAT
189            " _byte_map: " PTR_FORMAT " _byte_map + _byte_map_size: " PTR_FORMAT,
190            p2i(p), p2i(_byte_map), p2i(_byte_map + _byte_map_size));
191     size_t delta = pointer_delta(p, _byte_map_base, sizeof(CardValue));
192     HeapWord* result = (HeapWord*) (delta << card_shift);
193     assert(_whole_heap.contains(result),
194            "Returning result = " PTR_FORMAT " out of bounds of "
195            " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")",
196            p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()));
197     return result;
198   }
199 
200   // Mapping from address to card marking array index.
201   size_t index_for(void* p) {
202     assert(_whole_heap.contains(p),
203            "Attempt to access p = " PTR_FORMAT " out of bounds of "
204            " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")",
205            p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()));
206     return byte_for(p) - _byte_map;
207   }
208 
209   CardValue* byte_for_index(const size_t card_index) const {
210     return _byte_map + card_index;
211   }

171   }
172 
173   virtual void invalidate(MemRegion mr);
174   void clear(MemRegion mr);
175   void dirty(MemRegion mr);
176 
177   // Provide read-only access to the card table array.
178   const CardValue* byte_for_const(const void* p) const {
179     return byte_for(p);
180   }
181   const CardValue* byte_after_const(const void* p) const {
182     return byte_after(p);
183   }
184 
185   // Mapping from card marking array entry to address of first word
186   HeapWord* addr_for(const CardValue* p) const {
187     assert(p >= _byte_map && p < _byte_map + _byte_map_size,
188            "out of bounds access to card marking array. p: " PTR_FORMAT
189            " _byte_map: " PTR_FORMAT " _byte_map + _byte_map_size: " PTR_FORMAT,
190            p2i(p), p2i(_byte_map), p2i(_byte_map + _byte_map_size));
191     size_t delta =  (((uintptr_t) p) - ((uintptr_t) _byte_map_base)) / sizeof(CardValue);
192     HeapWord* result = (HeapWord*) (delta << card_shift);
193     assert(_whole_heap.contains(result),
194            "Returning result = " PTR_FORMAT " out of bounds of "
195            " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")",
196            p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end()));
197     return result;
198   }
199 
200   // Mapping from address to card marking array index.
201   size_t index_for(void* p) {
202     assert(_whole_heap.contains(p),
203            "Attempt to access p = " PTR_FORMAT " out of bounds of "
204            " card marking array's _whole_heap = [" PTR_FORMAT "," PTR_FORMAT ")",
205            p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end()));
206     return byte_for(p) - _byte_map;
207   }
208 
209   CardValue* byte_for_index(const size_t card_index) const {
210     return _byte_map + card_index;
211   }
< prev index next >