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

Print this page
rev 6796 : [mq]: templateOopIterate
rev 6799 : [mq]: latestChanges


  45 #include "gc_implementation/g1/g1MarkSweep.hpp"
  46 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
  47 #include "gc_implementation/g1/g1ParScanThreadState.inline.hpp"
  48 #include "gc_implementation/g1/g1RemSet.inline.hpp"
  49 #include "gc_implementation/g1/g1StringDedup.hpp"
  50 #include "gc_implementation/g1/g1YCTypes.hpp"
  51 #include "gc_implementation/g1/heapRegion.inline.hpp"
  52 #include "gc_implementation/g1/heapRegionRemSet.hpp"
  53 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
  54 #include "gc_implementation/g1/vm_operations_g1.hpp"
  55 #include "gc_implementation/shared/gcHeapSummary.hpp"
  56 #include "gc_implementation/shared/gcTimer.hpp"
  57 #include "gc_implementation/shared/gcTrace.hpp"
  58 #include "gc_implementation/shared/gcTraceTime.hpp"
  59 #include "gc_implementation/shared/isGCActiveMark.hpp"
  60 #include "memory/allocation.hpp"
  61 #include "memory/gcLocker.inline.hpp"
  62 #include "memory/generationSpec.hpp"
  63 #include "memory/iterator.hpp"
  64 #include "memory/referenceProcessor.hpp"



  65 #include "oops/oop.inline.hpp"
  66 #include "oops/oop.pcgc.inline.hpp"
  67 #include "runtime/atomic.inline.hpp"
  68 #include "runtime/orderAccess.inline.hpp"
  69 #include "runtime/vmThread.hpp"
  70 #include "utilities/globalDefinitions.hpp"
  71 
  72 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
  73 
  74 // turn it on so that the contents of the young list (scan-only /
  75 // to-be-collected) are printed at "strategic" points before / during
  76 // / after the collection --- this is useful for debugging
  77 #define YOUNG_LIST_VERBOSE 0
  78 // CURRENT STATUS
  79 // This file is under construction.  Search for "FIXME".
  80 
  81 // INVARIANTS/NOTES
  82 //
  83 // All allocation activity covered by the G1CollectedHeap interface is
  84 // serialized by acquiring the HeapLock.  This happens in mem_allocate


4508     oop obj = _objs_with_preserved_marks.pop();
4509     markOop m = _preserved_marks_of_objs.pop();
4510     obj->set_mark(m);
4511   }
4512   _objs_with_preserved_marks.clear(true);
4513   _preserved_marks_of_objs.clear(true);
4514 
4515   g1_policy()->phase_times()->record_evac_fail_remove_self_forwards((os::elapsedTime() - remove_self_forwards_start) * 1000.0);
4516 }
4517 
4518 void G1CollectedHeap::push_on_evac_failure_scan_stack(oop obj) {
4519   _evac_failure_scan_stack->push(obj);
4520 }
4521 
4522 void G1CollectedHeap::drain_evac_failure_scan_stack() {
4523   assert(_evac_failure_scan_stack != NULL, "precondition");
4524 
4525   while (_evac_failure_scan_stack->length() > 0) {
4526      oop obj = _evac_failure_scan_stack->pop();
4527      _evac_failure_closure->set_region(heap_region_containing(obj));
4528      obj->oop_iterate_backwards(_evac_failure_closure);
4529   }
4530 }
4531 
4532 oop
4533 G1CollectedHeap::handle_evacuation_failure_par(G1ParScanThreadState* _par_scan_state,
4534                                                oop old) {
4535   assert(obj_in_cs(old),
4536          err_msg("obj: "PTR_FORMAT" should still be in the CSet",
4537                  (HeapWord*) old));
4538   markOop m = old->mark();
4539   oop forward_ptr = old->forward_to_atomic(old);
4540   if (forward_ptr == NULL) {
4541     // Forward-to-self succeeded.
4542     assert(_par_scan_state != NULL, "par scan state");
4543     OopsInHeapRegionClosure* cl = _par_scan_state->evac_failure_closure();
4544     uint queue_num = _par_scan_state->queue_num();
4545 
4546     _evacuation_failed = true;
4547     _evacuation_failed_info_array[queue_num].register_copy_failure(old->size());
4548     if (_evac_failure_closure != cl) {




  45 #include "gc_implementation/g1/g1MarkSweep.hpp"
  46 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
  47 #include "gc_implementation/g1/g1ParScanThreadState.inline.hpp"
  48 #include "gc_implementation/g1/g1RemSet.inline.hpp"
  49 #include "gc_implementation/g1/g1StringDedup.hpp"
  50 #include "gc_implementation/g1/g1YCTypes.hpp"
  51 #include "gc_implementation/g1/heapRegion.inline.hpp"
  52 #include "gc_implementation/g1/heapRegionRemSet.hpp"
  53 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
  54 #include "gc_implementation/g1/vm_operations_g1.hpp"
  55 #include "gc_implementation/shared/gcHeapSummary.hpp"
  56 #include "gc_implementation/shared/gcTimer.hpp"
  57 #include "gc_implementation/shared/gcTrace.hpp"
  58 #include "gc_implementation/shared/gcTraceTime.hpp"
  59 #include "gc_implementation/shared/isGCActiveMark.hpp"
  60 #include "memory/allocation.hpp"
  61 #include "memory/gcLocker.inline.hpp"
  62 #include "memory/generationSpec.hpp"
  63 #include "memory/iterator.hpp"
  64 #include "memory/referenceProcessor.hpp"
  65 #include "memory/space.inline.hpp"
  66 #include "oops/objArrayKlass.hpp"
  67 #include "oops/objArrayOop.inline.hpp"
  68 #include "oops/oop.inline.hpp"
  69 #include "oops/oop.pcgc.inline.hpp"
  70 #include "runtime/atomic.inline.hpp"
  71 #include "runtime/orderAccess.inline.hpp"
  72 #include "runtime/vmThread.hpp"
  73 #include "utilities/globalDefinitions.hpp"
  74 
  75 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
  76 
  77 // turn it on so that the contents of the young list (scan-only /
  78 // to-be-collected) are printed at "strategic" points before / during
  79 // / after the collection --- this is useful for debugging
  80 #define YOUNG_LIST_VERBOSE 0
  81 // CURRENT STATUS
  82 // This file is under construction.  Search for "FIXME".
  83 
  84 // INVARIANTS/NOTES
  85 //
  86 // All allocation activity covered by the G1CollectedHeap interface is
  87 // serialized by acquiring the HeapLock.  This happens in mem_allocate


4511     oop obj = _objs_with_preserved_marks.pop();
4512     markOop m = _preserved_marks_of_objs.pop();
4513     obj->set_mark(m);
4514   }
4515   _objs_with_preserved_marks.clear(true);
4516   _preserved_marks_of_objs.clear(true);
4517 
4518   g1_policy()->phase_times()->record_evac_fail_remove_self_forwards((os::elapsedTime() - remove_self_forwards_start) * 1000.0);
4519 }
4520 
4521 void G1CollectedHeap::push_on_evac_failure_scan_stack(oop obj) {
4522   _evac_failure_scan_stack->push(obj);
4523 }
4524 
4525 void G1CollectedHeap::drain_evac_failure_scan_stack() {
4526   assert(_evac_failure_scan_stack != NULL, "precondition");
4527 
4528   while (_evac_failure_scan_stack->length() > 0) {
4529      oop obj = _evac_failure_scan_stack->pop();
4530      _evac_failure_closure->set_region(heap_region_containing(obj));
4531      obj->oop_iterate_backwards<false>(_evac_failure_closure);
4532   }
4533 }
4534 
4535 oop
4536 G1CollectedHeap::handle_evacuation_failure_par(G1ParScanThreadState* _par_scan_state,
4537                                                oop old) {
4538   assert(obj_in_cs(old),
4539          err_msg("obj: "PTR_FORMAT" should still be in the CSet",
4540                  (HeapWord*) old));
4541   markOop m = old->mark();
4542   oop forward_ptr = old->forward_to_atomic(old);
4543   if (forward_ptr == NULL) {
4544     // Forward-to-self succeeded.
4545     assert(_par_scan_state != NULL, "par scan state");
4546     OopsInHeapRegionClosure* cl = _par_scan_state->evac_failure_closure();
4547     uint queue_num = _par_scan_state->queue_num();
4548 
4549     _evacuation_failed = true;
4550     _evacuation_failed_info_array[queue_num].register_copy_failure(old->size());
4551     if (_evac_failure_closure != cl) {