< prev index next >

src/hotspot/share/gc/g1/g1EvacFailure.cpp

Print this page




  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/g1/dirtyCardQueue.hpp"
  27 #include "gc/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc/g1/g1CollectorState.hpp"
  29 #include "gc/g1/g1ConcurrentMark.inline.hpp"
  30 #include "gc/g1/g1EvacFailure.hpp"
  31 #include "gc/g1/g1HeapVerifier.hpp"
  32 #include "gc/g1/g1OopClosures.inline.hpp"
  33 #include "gc/g1/g1_globals.hpp"
  34 #include "gc/g1/heapRegion.hpp"
  35 #include "gc/g1/heapRegionRemSet.hpp"

  36 #include "gc/shared/preservedMarks.inline.hpp"
  37 #include "oops/access.inline.hpp"
  38 #include "oops/compressedOops.inline.hpp"
  39 #include "oops/oop.inline.hpp"
  40 
  41 class UpdateRSetDeferred : public BasicOopIterateClosure {
  42 private:
  43   G1CollectedHeap* _g1h;
  44   DirtyCardQueue* _dcq;
  45   G1CardTable*    _ct;
  46 
  47 public:
  48   UpdateRSetDeferred(DirtyCardQueue* dcq) :
  49     _g1h(G1CollectedHeap::heap()), _dcq(dcq), _ct(_g1h->card_table()) {}
  50 
  51   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
  52   virtual void do_oop(      oop* p) { do_oop_work(p); }
  53   template <class T> void do_oop_work(T* p) {
  54     assert(_g1h->heap_region_containing(p)->is_in_reserved(p), "paranoia");
  55     assert(!_g1h->heap_region_containing(p)->is_survivor(), "Unexpected evac failure in survivor region");


 145       // The problem is that, if evacuation fails, we might have
 146       // remembered set entries missing given that we skipped cards on
 147       // the collection set. So, we'll recreate such entries now.
 148       obj->oop_iterate(_update_rset_cl);
 149 
 150       HeapWord* obj_end = obj_addr + obj_size;
 151       _last_forwarded_object_end = obj_end;
 152       _hr->cross_threshold(obj_addr, obj_end);
 153     }
 154   }
 155 
 156   // Fill the memory area from start to end with filler objects, and update the BOT
 157   // and the mark bitmap accordingly.
 158   void zap_dead_objects(HeapWord* start, HeapWord* end) {
 159     if (start == end) {
 160       return;
 161     }
 162 
 163     size_t gap_size = pointer_delta(end, start);
 164     MemRegion mr(start, gap_size);
 165     if (gap_size >= CollectedHeap::min_fill_size()) {
 166       CollectedHeap::fill_with_objects(start, gap_size);
 167 
 168       HeapWord* end_first_obj = start + ((oop)start)->size();
 169       _hr->cross_threshold(start, end_first_obj);
 170       // Fill_with_objects() may have created multiple (i.e. two)
 171       // objects, as the max_fill_size() is half a region.
 172       // After updating the BOT for the first object, also update the
 173       // BOT for the second object to make the BOT complete.
 174       if (end_first_obj != end) {
 175         _hr->cross_threshold(end_first_obj, end);
 176 #ifdef ASSERT
 177         size_t size_second_obj = ((oop)end_first_obj)->size();
 178         HeapWord* end_of_second_obj = end_first_obj + size_second_obj;
 179         assert(end == end_of_second_obj,
 180                "More than two objects were used to fill the area from " PTR_FORMAT " to " PTR_FORMAT ", "
 181                "second objects size " SIZE_FORMAT " ends at " PTR_FORMAT,
 182                p2i(start), p2i(end), size_second_obj, p2i(end_of_second_obj));
 183 #endif
 184       }
 185     }
 186     _cm->clear_range_in_prev_bitmap(mr);
 187   }
 188 
 189   void zap_remainder() {
 190     zap_dead_objects(_last_forwarded_object_end, _hr->top());
 191   }




  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/g1/dirtyCardQueue.hpp"
  27 #include "gc/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc/g1/g1CollectorState.hpp"
  29 #include "gc/g1/g1ConcurrentMark.inline.hpp"
  30 #include "gc/g1/g1EvacFailure.hpp"
  31 #include "gc/g1/g1HeapVerifier.hpp"
  32 #include "gc/g1/g1OopClosures.inline.hpp"
  33 #include "gc/g1/g1_globals.hpp"
  34 #include "gc/g1/heapRegion.hpp"
  35 #include "gc/g1/heapRegionRemSet.hpp"
  36 #include "gc/shared/fill.hpp"
  37 #include "gc/shared/preservedMarks.inline.hpp"
  38 #include "oops/access.inline.hpp"
  39 #include "oops/compressedOops.inline.hpp"
  40 #include "oops/oop.inline.hpp"
  41 
  42 class UpdateRSetDeferred : public BasicOopIterateClosure {
  43 private:
  44   G1CollectedHeap* _g1h;
  45   DirtyCardQueue* _dcq;
  46   G1CardTable*    _ct;
  47 
  48 public:
  49   UpdateRSetDeferred(DirtyCardQueue* dcq) :
  50     _g1h(G1CollectedHeap::heap()), _dcq(dcq), _ct(_g1h->card_table()) {}
  51 
  52   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
  53   virtual void do_oop(      oop* p) { do_oop_work(p); }
  54   template <class T> void do_oop_work(T* p) {
  55     assert(_g1h->heap_region_containing(p)->is_in_reserved(p), "paranoia");
  56     assert(!_g1h->heap_region_containing(p)->is_survivor(), "Unexpected evac failure in survivor region");


 146       // The problem is that, if evacuation fails, we might have
 147       // remembered set entries missing given that we skipped cards on
 148       // the collection set. So, we'll recreate such entries now.
 149       obj->oop_iterate(_update_rset_cl);
 150 
 151       HeapWord* obj_end = obj_addr + obj_size;
 152       _last_forwarded_object_end = obj_end;
 153       _hr->cross_threshold(obj_addr, obj_end);
 154     }
 155   }
 156 
 157   // Fill the memory area from start to end with filler objects, and update the BOT
 158   // and the mark bitmap accordingly.
 159   void zap_dead_objects(HeapWord* start, HeapWord* end) {
 160     if (start == end) {
 161       return;
 162     }
 163 
 164     size_t gap_size = pointer_delta(end, start);
 165     MemRegion mr(start, gap_size);
 166     if (gap_size >= Fill::min_size()) {
 167       Fill::range(start, gap_size);
 168 
 169       HeapWord* end_first_obj = start + ((oop)start)->size();
 170       _hr->cross_threshold(start, end_first_obj);
 171       // Fill::range() may have created multiple (i.e. two)
 172       // objects, as the Fill::max_size() is half a region.
 173       // After updating the BOT for the first object, also update the
 174       // BOT for the second object to make the BOT complete.
 175       if (end_first_obj != end) {
 176         _hr->cross_threshold(end_first_obj, end);
 177 #ifdef ASSERT
 178         size_t size_second_obj = ((oop)end_first_obj)->size();
 179         HeapWord* end_of_second_obj = end_first_obj + size_second_obj;
 180         assert(end == end_of_second_obj,
 181                "More than two objects were used to fill the area from " PTR_FORMAT " to " PTR_FORMAT ", "
 182                "second objects size " SIZE_FORMAT " ends at " PTR_FORMAT,
 183                p2i(start), p2i(end), size_second_obj, p2i(end_of_second_obj));
 184 #endif
 185       }
 186     }
 187     _cm->clear_range_in_prev_bitmap(mr);
 188   }
 189 
 190   void zap_remainder() {
 191     zap_dead_objects(_last_forwarded_object_end, _hr->top());
 192   }


< prev index next >