comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 17688:2c2ae9e5f65d

8035326: Assume non-NULL references in G1CollectedHeap::in_cset_fast_test Summary: Remove the assumption that G1CollectedHeap::in_cset_fast_test needs to check for NULL references. Most of the time this is not required, making the code doing this check multiple times. Reviewed-by: stefank, mgerdin, jmasa
author tschatzl
date Wed, 26 Feb 2014 15:32:44 +0100
parents 889068b9a088
children 5d492d192cbf
comparison
equal deleted inserted replaced
17687:86b64209f715 17688:2c2ae9e5f65d
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,