comparison src/share/vm/gc_implementation/g1/concurrentMark.cpp @ 3867:ff53346271fe

6814390: G1: remove the concept of non-generational G1 Summary: Removed the possibility to turn off generational mode for G1. Reviewed-by: johnc, ysr, tonyp
author brutisso
date Fri, 19 Aug 2011 09:30:59 +0200
parents 5f6f2615433a
children 20213c8a3c40
comparison
equal deleted inserted replaced
3866:7c29742c41b4 3867:ff53346271fe
799 799
800 // Initialise marking structures. This has to be done in a STW phase. 800 // Initialise marking structures. This has to be done in a STW phase.
801 reset(); 801 reset();
802 } 802 }
803 803
804 class CMMarkRootsClosure: public OopsInGenClosure {
805 private:
806 ConcurrentMark* _cm;
807 G1CollectedHeap* _g1h;
808 bool _do_barrier;
809
810 public:
811 CMMarkRootsClosure(ConcurrentMark* cm,
812 G1CollectedHeap* g1h,
813 bool do_barrier) : _cm(cm), _g1h(g1h),
814 _do_barrier(do_barrier) { }
815
816 virtual void do_oop(narrowOop* p) { do_oop_work(p); }
817 virtual void do_oop( oop* p) { do_oop_work(p); }
818
819 template <class T> void do_oop_work(T* p) {
820 T heap_oop = oopDesc::load_heap_oop(p);
821 if (!oopDesc::is_null(heap_oop)) {
822 oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
823 assert(obj->is_oop() || obj->mark() == NULL,
824 "expected an oop, possibly with mark word displaced");
825 HeapWord* addr = (HeapWord*)obj;
826 if (_g1h->is_in_g1_reserved(addr)) {
827 _cm->grayRoot(obj);
828 }
829 }
830 if (_do_barrier) {
831 assert(!_g1h->is_in_g1_reserved(p),
832 "Should be called on external roots");
833 do_barrier(p);
834 }
835 }
836 };
837 804
838 void ConcurrentMark::checkpointRootsInitialPost() { 805 void ConcurrentMark::checkpointRootsInitialPost() {
839 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 806 G1CollectedHeap* g1h = G1CollectedHeap::heap();
840 807
841 // If we force an overflow during remark, the remark operation will 808 // If we force an overflow during remark, the remark operation will
864 831
865 // update_g1_committed() will be called at the end of an evac pause 832 // update_g1_committed() will be called at the end of an evac pause
866 // when marking is on. So, it's also called at the end of the 833 // when marking is on. So, it's also called at the end of the
867 // initial-mark pause to update the heap end, if the heap expands 834 // initial-mark pause to update the heap end, if the heap expands
868 // during it. No need to call it here. 835 // during it. No need to call it here.
869 }
870
871 // Checkpoint the roots into this generation from outside
872 // this generation. [Note this initial checkpoint need only
873 // be approximate -- we'll do a catch up phase subsequently.]
874 void ConcurrentMark::checkpointRootsInitial() {
875 assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped");
876 G1CollectedHeap* g1h = G1CollectedHeap::heap();
877
878 double start = os::elapsedTime();
879
880 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
881 g1p->record_concurrent_mark_init_start();
882 checkpointRootsInitialPre();
883
884 // YSR: when concurrent precleaning is in place, we'll
885 // need to clear the cached card table here
886
887 ResourceMark rm;
888 HandleMark hm;
889
890 g1h->ensure_parsability(false);
891 g1h->perm_gen()->save_marks();
892
893 CMMarkRootsClosure notOlder(this, g1h, false);
894 CMMarkRootsClosure older(this, g1h, true);
895
896 g1h->set_marking_started();
897 g1h->rem_set()->prepare_for_younger_refs_iterate(false);
898
899 g1h->process_strong_roots(true, // activate StrongRootsScope
900 false, // fake perm gen collection
901 SharedHeap::SO_AllClasses,
902 &notOlder, // Regular roots
903 NULL, // do not visit active blobs
904 &older // Perm Gen Roots
905 );
906 checkpointRootsInitialPost();
907
908 // Statistics.
909 double end = os::elapsedTime();
910 _init_times.add((end - start) * 1000.0);
911
912 g1p->record_concurrent_mark_init_end();
913 } 836 }
914 837
915 /* 838 /*
916 * Notice that in the next two methods, we actually leave the STS 839 * Notice that in the next two methods, we actually leave the STS
917 * during the barrier sync and join it immediately afterwards. If we 840 * during the barrier sync and join it immediately afterwards. If we