176 |
176 |
177 // This is a fast test on whether a reference points into the |
177 // This is a fast test on whether a reference points into the |
178 // collection set or not. Assume that the reference |
178 // collection set or not. Assume that the reference |
179 // points into the heap. |
179 // points into the heap. |
180 inline bool G1CollectedHeap::in_cset_fast_test(oop obj) { |
180 inline bool G1CollectedHeap::in_cset_fast_test(oop obj) { |
181 assert(_in_cset_fast_test != NULL, "sanity"); |
181 bool ret = _in_cset_fast_test.get_by_address((HeapWord*)obj); |
182 assert(_g1_committed.contains((HeapWord*) obj), err_msg("Given reference outside of heap, is "PTR_FORMAT, p2i((HeapWord*)obj))); |
|
183 // no need to subtract the bottom of the heap from obj, |
|
184 // _in_cset_fast_test is biased |
|
185 uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes; |
|
186 bool ret = _in_cset_fast_test[index]; |
|
187 // let's make sure the result is consistent with what the slower |
182 // let's make sure the result is consistent with what the slower |
188 // test returns |
183 // test returns |
189 assert( ret || !obj_in_cs(obj), "sanity"); |
184 assert( ret || !obj_in_cs(obj), "sanity"); |
190 assert(!ret || obj_in_cs(obj), "sanity"); |
185 assert(!ret || obj_in_cs(obj), "sanity"); |
191 return ret; |
186 return ret; |