< prev index next >

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

Print this page
rev 49670 : imported patch 8178105-switch-at-remark
rev 49671 : imported patch 8178105-stefanj-review
rev 49672 : imported patch 8178105-stefanj-review2
rev 49674 : imported patch 8154528-reclaim-at-remark
rev 49675 : imported patch 8154528-stefanj-review
rev 49678 : imported patch 8200426-sangheon-review
rev 49679 : imported patch 8200730-timing-in-remark-cleanup
rev 49683 : imported patch 8201172-parallelize-remark-phase
rev 49684 : imported patch 8201172-stefanj-review
rev 49686 : imported patch 8201490-improve-conc-mark-keepalive
rev 49688 : [mq]: 8201527-default-refprocdraininterval


1394   HeapWord* addr = (HeapWord*)obj;
1395   return addr != NULL &&
1396          (!_g1h->is_in_g1_reserved(addr) || !_g1h->is_obj_ill(obj));
1397 }
1398 
1399 // 'Keep Alive' oop closure used by both serial parallel reference processing.
1400 // Uses the G1CMTask associated with a worker thread (for serial reference
1401 // processing the G1CMTask for worker 0 is used) to preserve (mark) and
1402 // trace referent objects.
1403 //
1404 // Using the G1CMTask and embedded local queues avoids having the worker
1405 // threads operating on the global mark stack. This reduces the risk
1406 // of overflowing the stack - which we would rather avoid at this late
1407 // state. Also using the tasks' local queues removes the potential
1408 // of the workers interfering with each other that could occur if
1409 // operating on the global stack.
1410 
1411 class G1CMKeepAliveAndDrainClosure : public OopClosure {
1412   G1ConcurrentMark* _cm;
1413   G1CMTask*         _task;
1414   int               _ref_counter_limit;
1415   int               _ref_counter;
1416   bool              _is_serial;
1417 public:
1418   G1CMKeepAliveAndDrainClosure(G1ConcurrentMark* cm, G1CMTask* task, bool is_serial) :
1419     _cm(cm), _task(task), _is_serial(is_serial),
1420     _ref_counter_limit(G1RefProcDrainInterval) {
1421     assert(_ref_counter_limit > 0, "sanity");
1422     assert(!_is_serial || _task->worker_id() == 0, "only task 0 for serial code");
1423     _ref_counter = _ref_counter_limit;
1424   }
1425 
1426   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
1427   virtual void do_oop(      oop* p) { do_oop_work(p); }
1428 
1429   template <class T> void do_oop_work(T* p) {
1430     if (_cm->has_overflown()) {
1431       return;
1432     }
1433     if (!_task->deal_with_reference(p)) {
1434       // We did not add anything to the mark bitmap (or mark stack), so there is
1435       // no point trying to drain it.
1436       return;
1437     }
1438     _ref_counter--;
1439 
1440     if (_ref_counter == 0) {
1441       // We have dealt with _ref_counter_limit references, pushing them




1394   HeapWord* addr = (HeapWord*)obj;
1395   return addr != NULL &&
1396          (!_g1h->is_in_g1_reserved(addr) || !_g1h->is_obj_ill(obj));
1397 }
1398 
1399 // 'Keep Alive' oop closure used by both serial parallel reference processing.
1400 // Uses the G1CMTask associated with a worker thread (for serial reference
1401 // processing the G1CMTask for worker 0 is used) to preserve (mark) and
1402 // trace referent objects.
1403 //
1404 // Using the G1CMTask and embedded local queues avoids having the worker
1405 // threads operating on the global mark stack. This reduces the risk
1406 // of overflowing the stack - which we would rather avoid at this late
1407 // state. Also using the tasks' local queues removes the potential
1408 // of the workers interfering with each other that could occur if
1409 // operating on the global stack.
1410 
1411 class G1CMKeepAliveAndDrainClosure : public OopClosure {
1412   G1ConcurrentMark* _cm;
1413   G1CMTask*         _task;
1414   uint              _ref_counter_limit;
1415   uint              _ref_counter;
1416   bool              _is_serial;
1417 public:
1418   G1CMKeepAliveAndDrainClosure(G1ConcurrentMark* cm, G1CMTask* task, bool is_serial) :
1419     _cm(cm), _task(task), _is_serial(is_serial),
1420     _ref_counter_limit(G1RefProcDrainInterval) {

1421     assert(!_is_serial || _task->worker_id() == 0, "only task 0 for serial code");
1422     _ref_counter = _ref_counter_limit;
1423   }
1424 
1425   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
1426   virtual void do_oop(      oop* p) { do_oop_work(p); }
1427 
1428   template <class T> void do_oop_work(T* p) {
1429     if (_cm->has_overflown()) {
1430       return;
1431     }
1432     if (!_task->deal_with_reference(p)) {
1433       // We did not add anything to the mark bitmap (or mark stack), so there is
1434       // no point trying to drain it.
1435       return;
1436     }
1437     _ref_counter--;
1438 
1439     if (_ref_counter == 0) {
1440       // We have dealt with _ref_counter_limit references, pushing them


< prev index next >