914 _iter_state = Unclaimed;
915 _iter_claimed = 0;
916 // It's good to check this to make sure that the two methods are in sync.
917 assert(verify_ready_for_par_iteration(), "post-condition");
918 }
919
920 void HeapRegionRemSet::scrub(CardTableModRefBS* ctbs,
921 BitMap* region_bm, BitMap* card_bm) {
922 _other_regions.scrub(ctbs, region_bm, card_bm);
923 }
924
925 // Code roots support
926
927 void HeapRegionRemSet::add_strong_code_root(nmethod* nm) {
928 assert(nm != NULL, "sanity");
929 _code_roots.add(nm);
930 }
931
932 void HeapRegionRemSet::remove_strong_code_root(nmethod* nm) {
933 assert(nm != NULL, "sanity");
934 _code_roots.remove(nm);
935 // Check that there were no duplicates
936 guarantee(!_code_roots.contains(nm), "duplicate entry found");
937 }
938
939 class NMethodMigrationOopClosure : public OopClosure {
940 G1CollectedHeap* _g1h;
941 HeapRegion* _from;
942 nmethod* _nm;
943
944 uint _num_self_forwarded;
945
946 template <class T> void do_oop_work(T* p) {
947 T heap_oop = oopDesc::load_heap_oop(p);
948 if (!oopDesc::is_null(heap_oop)) {
949 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
950 if (_from->is_in(obj)) {
951 // Reference still points into the source region.
952 // Since roots are immediately evacuated this means that
953 // we must have self forwarded the object
954 assert(obj->is_forwarded(),
|
914 _iter_state = Unclaimed;
915 _iter_claimed = 0;
916 // It's good to check this to make sure that the two methods are in sync.
917 assert(verify_ready_for_par_iteration(), "post-condition");
918 }
919
920 void HeapRegionRemSet::scrub(CardTableModRefBS* ctbs,
921 BitMap* region_bm, BitMap* card_bm) {
922 _other_regions.scrub(ctbs, region_bm, card_bm);
923 }
924
925 // Code roots support
926
927 void HeapRegionRemSet::add_strong_code_root(nmethod* nm) {
928 assert(nm != NULL, "sanity");
929 _code_roots.add(nm);
930 }
931
932 void HeapRegionRemSet::remove_strong_code_root(nmethod* nm) {
933 assert(nm != NULL, "sanity");
934 assert_locked_or_safepoint(CodeCache_lock);
935
936 _code_roots.remove_lock_free(nm);
937
938 // Check that there were no duplicates
939 guarantee(!_code_roots.contains(nm), "duplicate entry found");
940 }
941
942 class NMethodMigrationOopClosure : public OopClosure {
943 G1CollectedHeap* _g1h;
944 HeapRegion* _from;
945 nmethod* _nm;
946
947 uint _num_self_forwarded;
948
949 template <class T> void do_oop_work(T* p) {
950 T heap_oop = oopDesc::load_heap_oop(p);
951 if (!oopDesc::is_null(heap_oop)) {
952 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
953 if (_from->is_in(obj)) {
954 // Reference still points into the source region.
955 // Since roots are immediately evacuated this means that
956 // we must have self forwarded the object
957 assert(obj->is_forwarded(),
|