681 // false otherwise.
682 // (Rounds up to a HeapRegion boundary.)
683 bool expand(size_t expand_bytes);
684
685 // Do anything common to GC's.
686 virtual void gc_prologue(bool full);
687 virtual void gc_epilogue(bool full);
688
689 // We register a region with the fast "in collection set" test. We
690 // simply set to true the array slot corresponding to this region.
691 void register_region_with_in_cset_fast_test(HeapRegion* r) {
692 assert(_in_cset_fast_test_base != NULL, "sanity");
693 assert(r->in_collection_set(), "invariant");
694 uint index = r->hrs_index();
695 assert(index < _in_cset_fast_test_length, "invariant");
696 assert(!_in_cset_fast_test_base[index], "invariant");
697 _in_cset_fast_test_base[index] = true;
698 }
699
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
702 // points into the heap; if it doesn't, it will return false.
703 bool in_cset_fast_test(oop obj) {
704 assert(_in_cset_fast_test != NULL, "sanity");
705 if (_g1_committed.contains((HeapWord*) obj)) {
706 // no need to subtract the bottom of the heap from obj,
707 // _in_cset_fast_test is biased
708 uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes;
709 bool ret = _in_cset_fast_test[index];
710 // let's make sure the result is consistent with what the slower
711 // test returns
712 assert( ret || !obj_in_cs(obj), "sanity");
713 assert(!ret || obj_in_cs(obj), "sanity");
714 return ret;
715 } else {
716 return false;
717 }
718 }
719
720 void clear_cset_fast_test() {
721 assert(_in_cset_fast_test_base != NULL, "sanity");
722 memset(_in_cset_fast_test_base, false,
723 (size_t) _in_cset_fast_test_length * sizeof(bool));
724 }
725
726 // This is called at the start of either a concurrent cycle or a Full
727 // GC to update the number of old marking cycles started.
728 void increment_old_marking_cycles_started();
729
730 // This is called at the end of either a concurrent cycle or a Full
731 // GC to update the number of old marking cycles completed. Those two
732 // can happen in a nested fashion, i.e., we start a concurrent
733 // cycle, a Full GC happens half-way through it which ends first,
734 // and then the cycle notices that a Full GC happened and ends
735 // too. The concurrent parameter is a boolean to help us do a bit
736 // tighter consistency checking in the method. If concurrent is
737 // false, the caller is the inner caller in the nesting (i.e., the
|
681 // false otherwise.
682 // (Rounds up to a HeapRegion boundary.)
683 bool expand(size_t expand_bytes);
684
685 // Do anything common to GC's.
686 virtual void gc_prologue(bool full);
687 virtual void gc_epilogue(bool full);
688
689 // We register a region with the fast "in collection set" test. We
690 // simply set to true the array slot corresponding to this region.
691 void register_region_with_in_cset_fast_test(HeapRegion* r) {
692 assert(_in_cset_fast_test_base != NULL, "sanity");
693 assert(r->in_collection_set(), "invariant");
694 uint index = r->hrs_index();
695 assert(index < _in_cset_fast_test_length, "invariant");
696 assert(!_in_cset_fast_test_base[index], "invariant");
697 _in_cset_fast_test_base[index] = true;
698 }
699
700 // This is a fast test on whether a reference points into the
701 // collection set or not. Assume that the reference
702 // points into the heap.
703 bool in_cset_fast_test(oop obj) {
704 assert(_in_cset_fast_test != NULL, "sanity");
705 assert(_g1_committed.contains((HeapWord*) obj), "");
706 // no need to subtract the bottom of the heap from obj,
707 // _in_cset_fast_test is biased
708 uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes;
709 bool ret = _in_cset_fast_test[index];
710 // let's make sure the result is consistent with what the slower
711 // test returns
712 assert( ret || !obj_in_cs(obj), "sanity");
713 assert(!ret || obj_in_cs(obj), "sanity");
714 return ret;
715 }
716
717 void clear_cset_fast_test() {
718 assert(_in_cset_fast_test_base != NULL, "sanity");
719 memset(_in_cset_fast_test_base, false,
720 (size_t) _in_cset_fast_test_length * sizeof(bool));
721 }
722
723 // This is called at the start of either a concurrent cycle or a Full
724 // GC to update the number of old marking cycles started.
725 void increment_old_marking_cycles_started();
726
727 // This is called at the end of either a concurrent cycle or a Full
728 // GC to update the number of old marking cycles completed. Those two
729 // can happen in a nested fashion, i.e., we start a concurrent
730 // cycle, a Full GC happens half-way through it which ends first,
731 // and then the cycle notices that a Full GC happened and ends
732 // too. The concurrent parameter is a boolean to help us do a bit
733 // tighter consistency checking in the method. If concurrent is
734 // false, the caller is the inner caller in the nesting (i.e., the
|