< prev index next >

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

Print this page




   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");


 169 };
 170 
 171 class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {
 172   G1CollectedHeap* _g1h;
 173   ConcurrentMark* _cm;
 174   uint _worker_id;
 175   HeapRegionClaimer* _hrclaimer;
 176 
 177   DirtyCardQueue _dcq;
 178   UpdateRSetDeferred _update_rset_cl;
 179 
 180 public:
 181   RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h,
 182                                 uint worker_id,
 183                                 HeapRegionClaimer* hrclaimer) :
 184       _g1h(g1h), _dcq(&g1h->dirty_card_queue_set()), _update_rset_cl(g1h, &_dcq),
 185       _worker_id(worker_id), _cm(_g1h->concurrent_mark()), _hrclaimer(hrclaimer) {
 186   }
 187 
 188   bool doHeapRegion(HeapRegion *hr) {
 189     bool during_initial_mark = _g1h->g1_policy()->during_initial_mark_pause();
 190     bool during_conc_mark = _g1h->mark_in_progress();
 191 
 192     assert(!hr->is_humongous(), "sanity");
 193     assert(hr->in_collection_set(), "bad CS");
 194 
 195     if (_hrclaimer->claim_region(hr->hrm_index())) {
 196       if (hr->evacuation_failed()) {
 197         RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, &_update_rset_cl,
 198                                             during_initial_mark,
 199                                             during_conc_mark,
 200                                             _worker_id);
 201 
 202         hr->note_self_forwarding_removal_start(during_initial_mark,
 203                                                during_conc_mark);
 204         _g1h->check_bitmaps("Self-Forwarding Ptr Removal", hr);
 205 
 206         // In the common case (i.e. when there is no evacuation
 207         // failure) we make sure that the following is done when
 208         // the region is freed so that it is "ready-to-go" when it's
 209         // re-allocated. However, when evacuation failure happens, a
 210         // region will remain in the heap and might ultimately be added




   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/g1CollectorState.hpp"
  30 #include "gc_implementation/g1/g1EvacFailure.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 
  36 class UpdateRSetDeferred : public OopsInHeapRegionClosure {
  37 private:
  38   G1CollectedHeap* _g1;
  39   DirtyCardQueue *_dcq;
  40   G1SATBCardTableModRefBS* _ct_bs;
  41 
  42 public:
  43   UpdateRSetDeferred(G1CollectedHeap* g1, DirtyCardQueue* dcq) :
  44     _g1(g1), _ct_bs(_g1->g1_barrier_set()), _dcq(dcq) {}
  45 
  46   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
  47   virtual void do_oop(      oop* p) { do_oop_work(p); }
  48   template <class T> void do_oop_work(T* p) {
  49     assert(_from->is_in_reserved(p), "paranoia");


 170 };
 171 
 172 class RemoveSelfForwardPtrHRClosure: public HeapRegionClosure {
 173   G1CollectedHeap* _g1h;
 174   ConcurrentMark* _cm;
 175   uint _worker_id;
 176   HeapRegionClaimer* _hrclaimer;
 177 
 178   DirtyCardQueue _dcq;
 179   UpdateRSetDeferred _update_rset_cl;
 180 
 181 public:
 182   RemoveSelfForwardPtrHRClosure(G1CollectedHeap* g1h,
 183                                 uint worker_id,
 184                                 HeapRegionClaimer* hrclaimer) :
 185       _g1h(g1h), _dcq(&g1h->dirty_card_queue_set()), _update_rset_cl(g1h, &_dcq),
 186       _worker_id(worker_id), _cm(_g1h->concurrent_mark()), _hrclaimer(hrclaimer) {
 187   }
 188 
 189   bool doHeapRegion(HeapRegion *hr) {
 190     bool during_initial_mark = _g1h->collector_state()->during_initial_mark_pause();
 191     bool during_conc_mark = _g1h->collector_state()->mark_in_progress();
 192 
 193     assert(!hr->is_humongous(), "sanity");
 194     assert(hr->in_collection_set(), "bad CS");
 195 
 196     if (_hrclaimer->claim_region(hr->hrm_index())) {
 197       if (hr->evacuation_failed()) {
 198         RemoveSelfForwardPtrObjClosure rspc(_g1h, _cm, hr, &_update_rset_cl,
 199                                             during_initial_mark,
 200                                             during_conc_mark,
 201                                             _worker_id);
 202 
 203         hr->note_self_forwarding_removal_start(during_initial_mark,
 204                                                during_conc_mark);
 205         _g1h->check_bitmaps("Self-Forwarding Ptr Removal", hr);
 206 
 207         // In the common case (i.e. when there is no evacuation
 208         // failure) we make sure that the following is done when
 209         // the region is freed so that it is "ready-to-go" when it's
 210         // re-allocated. However, when evacuation failure happens, a
 211         // region will remain in the heap and might ultimately be added


< prev index next >