696 assert(!_in_cset_fast_test_base[index], "invariant"); |
696 assert(!_in_cset_fast_test_base[index], "invariant"); |
697 _in_cset_fast_test_base[index] = true; |
697 _in_cset_fast_test_base[index] = true; |
698 } |
698 } |
699 |
699 |
700 // This is a fast test on whether a reference points into the |
700 // This is a fast test on whether a reference points into the |
701 // collection set or not. It does not assume that the reference |
701 // collection set or not. Assume that the reference |
702 // points into the heap; if it doesn't, it will return false. |
702 // points into the heap. |
703 bool in_cset_fast_test(oop obj) { |
703 bool in_cset_fast_test(oop obj) { |
704 assert(_in_cset_fast_test != NULL, "sanity"); |
704 assert(_in_cset_fast_test != NULL, "sanity"); |
705 if (_g1_committed.contains((HeapWord*) obj)) { |
705 assert(_g1_committed.contains((HeapWord*) obj), err_msg("Given reference outside of heap, is "PTR_FORMAT, (HeapWord*)obj)); |
706 // no need to subtract the bottom of the heap from obj, |
706 // no need to subtract the bottom of the heap from obj, |
707 // _in_cset_fast_test is biased |
707 // _in_cset_fast_test is biased |
708 uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes; |
708 uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes; |
709 bool ret = _in_cset_fast_test[index]; |
709 bool ret = _in_cset_fast_test[index]; |
710 // let's make sure the result is consistent with what the slower |
710 // let's make sure the result is consistent with what the slower |
711 // test returns |
711 // test returns |
712 assert( ret || !obj_in_cs(obj), "sanity"); |
712 assert( ret || !obj_in_cs(obj), "sanity"); |
713 assert(!ret || obj_in_cs(obj), "sanity"); |
713 assert(!ret || obj_in_cs(obj), "sanity"); |
714 return ret; |
714 return ret; |
715 } else { |
|
716 return false; |
|
717 } |
|
718 } |
715 } |
719 |
716 |
720 void clear_cset_fast_test() { |
717 void clear_cset_fast_test() { |
721 assert(_in_cset_fast_test_base != NULL, "sanity"); |
718 assert(_in_cset_fast_test_base != NULL, "sanity"); |
722 memset(_in_cset_fast_test_base, false, |
719 memset(_in_cset_fast_test_base, false, |