hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
changeset 2252 703d28e44a42
parent 2154 72a9b7284ccf
parent 2250 36d1eb1bb075
child 2260 219013f6a311
equal deleted inserted replaced
2225:a25c5ec5e40e 2252:703d28e44a42
   500                   count_cl.mx(), count_cl.mxr());
   500                   count_cl.mx(), count_cl.mxr());
   501     count_cl.print_histo();
   501     count_cl.print_histo();
   502   }
   502   }
   503 
   503 
   504   if (ParallelGCThreads > 0) {
   504   if (ParallelGCThreads > 0) {
   505     // This is a temporary change to serialize the update and scanning
   505     // The two flags below were introduced temporarily to serialize
   506     // of remembered sets. There are some race conditions when this is
   506     // the updating and scanning of remembered sets. There are some
   507     // done in parallel and they are causing failures. When we resolve
   507     // race conditions when these two operations are done in parallel
   508     // said race conditions, we'll revert back to parallel remembered
   508     // and they are causing failures. When we resolve said race
   509     // set updating and scanning. See CRs 6677707 and 6677708.
   509     // conditions, we'll revert back to parallel remembered set
   510     if (worker_i == 0) {
   510     // updating and scanning. See CRs 6677707 and 6677708.
       
   511     if (G1EnableParallelRSetUpdating || (worker_i == 0)) {
   511       updateRS(worker_i);
   512       updateRS(worker_i);
   512       scanNewRefsRS(oc, worker_i);
   513       scanNewRefsRS(oc, worker_i);
       
   514     }
       
   515     if (G1EnableParallelRSetScanning || (worker_i == 0)) {
   513       scanRS(oc, worker_i);
   516       scanRS(oc, worker_i);
   514     }
   517     }
   515   } else {
   518   } else {
   516     assert(worker_i == 0, "invariant");
   519     assert(worker_i == 0, "invariant");
   517     updateRS(0);
   520     updateRS(0);
   714   {}
   717   {}
   715 
   718 
   716   bool doHeapRegion(HeapRegion* r) {
   719   bool doHeapRegion(HeapRegion* r) {
   717     if (!r->in_collection_set() &&
   720     if (!r->in_collection_set() &&
   718         !r->continuesHumongous() &&
   721         !r->continuesHumongous() &&
   719         !r->is_young() &&
   722         !r->is_young()) {
   720         !r->is_survivor()) {
       
   721       _update_rs_oop_cl.set_from(r);
   723       _update_rs_oop_cl.set_from(r);
   722       UpdateRSObjectClosure update_rs_obj_cl(&_update_rs_oop_cl);
   724       UpdateRSObjectClosure update_rs_obj_cl(&_update_rs_oop_cl);
   723 
   725 
   724       // For each run of dirty card in the region:
   726       // For each run of dirty card in the region:
   725       //   1) Clear the cards.
   727       //   1) Clear the cards.
   852   // as a result, it is possible for other threads to actually
   854   // as a result, it is possible for other threads to actually
   853   // allocate objects in the region (after the acquire the lock)
   855   // allocate objects in the region (after the acquire the lock)
   854   // before all the cards on the region are dirtied. This is unlikely,
   856   // before all the cards on the region are dirtied. This is unlikely,
   855   // and it doesn't happen often, but it can happen. So, the extra
   857   // and it doesn't happen often, but it can happen. So, the extra
   856   // check below filters out those cards.
   858   // check below filters out those cards.
   857   if (r->is_young() || r->is_survivor()) {
   859   if (r->is_young()) {
   858     return;
   860     return;
   859   }
   861   }
   860   // While we are processing RSet buffers during the collection, we
   862   // While we are processing RSet buffers during the collection, we
   861   // actually don't want to scan any cards on the collection set,
   863   // actually don't want to scan any cards on the collection set,
   862   // since we don't want to update remebered sets with entries that
   864   // since we don't want to update remebered sets with entries that
  1023                   HeapRegionRemSet::n_coarsenings());
  1025                   HeapRegionRemSet::n_coarsenings());
  1024 
  1026 
  1025   }
  1027   }
  1026 }
  1028 }
  1027 void HRInto_G1RemSet::prepare_for_verify() {
  1029 void HRInto_G1RemSet::prepare_for_verify() {
  1028   if (G1HRRSFlushLogBuffersOnVerify && VerifyBeforeGC && !_g1->full_collection()) {
  1030   if (G1HRRSFlushLogBuffersOnVerify &&
       
  1031       (VerifyBeforeGC || VerifyAfterGC)
       
  1032       &&  !_g1->full_collection()) {
  1029     cleanupHRRS();
  1033     cleanupHRRS();
  1030     _g1->set_refine_cte_cl_concurrency(false);
  1034     _g1->set_refine_cte_cl_concurrency(false);
  1031     if (SafepointSynchronize::is_at_safepoint()) {
  1035     if (SafepointSynchronize::is_at_safepoint()) {
  1032       DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
  1036       DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
  1033       dcqs.concatenate_logs();
  1037       dcqs.concatenate_logs();
  1034     }
  1038     }
  1035     bool cg1r_use_cache = _cg1r->use_cache();
  1039     bool cg1r_use_cache = _cg1r->use_cache();
  1036     _cg1r->set_use_cache(false);
  1040     _cg1r->set_use_cache(false);
  1037     updateRS(0);
  1041     updateRS(0);
  1038     _cg1r->set_use_cache(cg1r_use_cache);
  1042     _cg1r->set_use_cache(cg1r_use_cache);
  1039   }
  1043 
  1040 }
  1044     assert(JavaThread::dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
       
  1045   }
       
  1046 }