< prev index next >

src/share/vm/gc_implementation/g1/g1EvacFailure.cpp

Print this page


   1 /*
   2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1EVACFAILURE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1EVACFAILURE_HPP
  27 
  28 #include "gc_implementation/g1/concurrentMark.inline.hpp"
  29 #include "gc_implementation/g1/dirtyCardQueue.hpp"
  30 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"

  31 #include "gc_implementation/g1/g1_globals.hpp"
  32 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
  33 #include "gc_implementation/g1/heapRegion.hpp"
  34 #include "gc_implementation/g1/heapRegionRemSet.hpp"
  35 #include "utilities/workgroup.hpp"
  36 
  37 // Closures and tasks associated with any self-forwarding pointers
  38 // installed as a result of an evacuation failure.
  39 
  40 class UpdateRSetDeferred : public OopsInHeapRegionClosure {
  41 private:
  42   G1CollectedHeap* _g1;
  43   DirtyCardQueue *_dcq;
  44   G1SATBCardTableModRefBS* _ct_bs;
  45 
  46 public:
  47   UpdateRSetDeferred(G1CollectedHeap* g1, DirtyCardQueue* dcq) :
  48     _g1(g1), _ct_bs(_g1->g1_barrier_set()), _dcq(dcq) {}
  49 
  50   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
  51   virtual void do_oop(      oop* p) { do_oop_work(p); }
  52   template <class T> void do_oop_work(T* p) {
  53     assert(_from->is_in_reserved(p), "paranoia");
  54     if (!_from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) &&
  55         !_from->is_survivor()) {
  56       size_t card_index = _ct_bs->index_for(p);
  57       if (_ct_bs->mark_card_deferred(card_index)) {
  58         _dcq->enqueue((jbyte*)_ct_bs->byte_for_index(card_index));


 215         // region will remain in the heap and might ultimately be added
 216         // to a CSet in the future. So we have to be careful here and
 217         // make sure the region's RSet is ready for parallel iteration
 218         // whenever this might be required in the future.
 219         hr->rem_set()->reset_for_par_iteration();
 220         hr->reset_bot();
 221         _update_rset_cl.set_region(hr);
 222         hr->object_iterate(&rspc);
 223 
 224         hr->rem_set()->clean_strong_code_roots(hr);
 225 
 226         hr->note_self_forwarding_removal_end(during_initial_mark,
 227                                              during_conc_mark,
 228                                              rspc.marked_bytes());
 229       }
 230     }
 231     return false;
 232   }
 233 };
 234 
 235 class G1ParRemoveSelfForwardPtrsTask: public AbstractGangTask {
 236 protected:
 237   G1CollectedHeap* _g1h;
 238   HeapRegionClaimer _hrclaimer;
 239 
 240 public:
 241   G1ParRemoveSelfForwardPtrsTask(G1CollectedHeap* g1h) :
 242       AbstractGangTask("G1 Remove Self-forwarding Pointers"), _g1h(g1h),
 243       _hrclaimer(g1h->workers()->active_workers()) {}
 244 
 245   void work(uint worker_id) {
 246     RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, worker_id, &_hrclaimer);
 247 
 248     HeapRegion* hr = _g1h->start_cset_region_for_worker(worker_id);
 249     _g1h->collection_set_iterate_from(hr, &rsfp_cl);
 250   }
 251 };
 252 
 253 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1EVACFAILURE_HPP
   1 /*
   2  * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"


  26 #include "gc_implementation/g1/concurrentMark.inline.hpp"
  27 #include "gc_implementation/g1/dirtyCardQueue.hpp"
  28 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  29 #include "gc_implementation/g1/g1EvacFailure.hpp"
  30 #include "gc_implementation/g1/g1_globals.hpp"
  31 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
  32 #include "gc_implementation/g1/heapRegion.hpp"
  33 #include "gc_implementation/g1/heapRegionRemSet.hpp"




  34 
  35 class UpdateRSetDeferred : public OopsInHeapRegionClosure {
  36 private:
  37   G1CollectedHeap* _g1;
  38   DirtyCardQueue *_dcq;
  39   G1SATBCardTableModRefBS* _ct_bs;
  40 
  41 public:
  42   UpdateRSetDeferred(G1CollectedHeap* g1, DirtyCardQueue* dcq) :
  43     _g1(g1), _ct_bs(_g1->g1_barrier_set()), _dcq(dcq) {}
  44 
  45   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
  46   virtual void do_oop(      oop* p) { do_oop_work(p); }
  47   template <class T> void do_oop_work(T* p) {
  48     assert(_from->is_in_reserved(p), "paranoia");
  49     if (!_from->is_in_reserved(oopDesc::load_decode_heap_oop(p)) &&
  50         !_from->is_survivor()) {
  51       size_t card_index = _ct_bs->index_for(p);
  52       if (_ct_bs->mark_card_deferred(card_index)) {
  53         _dcq->enqueue((jbyte*)_ct_bs->byte_for_index(card_index));


 210         // region will remain in the heap and might ultimately be added
 211         // to a CSet in the future. So we have to be careful here and
 212         // make sure the region's RSet is ready for parallel iteration
 213         // whenever this might be required in the future.
 214         hr->rem_set()->reset_for_par_iteration();
 215         hr->reset_bot();
 216         _update_rset_cl.set_region(hr);
 217         hr->object_iterate(&rspc);
 218 
 219         hr->rem_set()->clean_strong_code_roots(hr);
 220 
 221         hr->note_self_forwarding_removal_end(during_initial_mark,
 222                                              during_conc_mark,
 223                                              rspc.marked_bytes());
 224       }
 225     }
 226     return false;
 227   }
 228 };
 229 
 230 G1ParRemoveSelfForwardPtrsTask::G1ParRemoveSelfForwardPtrsTask(G1CollectedHeap* g1h) :






 231     AbstractGangTask("G1 Remove Self-forwarding Pointers"), _g1h(g1h),
 232     _hrclaimer(g1h->workers()->active_workers()) {}
 233 
 234 void G1ParRemoveSelfForwardPtrsTask::work(uint worker_id) {
 235   RemoveSelfForwardPtrHRClosure rsfp_cl(_g1h, worker_id, &_hrclaimer);
 236 
 237   HeapRegion* hr = _g1h->start_cset_region_for_worker(worker_id);
 238   _g1h->collection_set_iterate_from(hr, &rsfp_cl);
 239 }



< prev index next >