< prev index next >

src/hotspot/share/gc/shared/weakProcessor.inline.hpp

Print this page

 48   size_t _new_dead;
 49   size_t _live;
 50 
 51 public:
 52   CountingClosure(IsAlive* is_alive, KeepAlive* keep_alive) :
 53     _is_alive(is_alive),
 54     _keep_alive(keep_alive),
 55     _old_dead(0),
 56     _new_dead(0),
 57     _live(0)
 58   {}
 59 
 60   void do_oop(oop* p) {
 61     oop obj = *p;
 62     if (obj == NULL) {
 63       ++_old_dead;
 64     } else if (_is_alive->do_object_b(obj)) {
 65       _keep_alive->do_oop(p);
 66       ++_live;
 67     } else {

 68       *p = NULL;
 69       ++_new_dead;
 70     }
 71   }
 72 
 73   size_t dead() const { return _old_dead + _new_dead; }
 74   size_t new_dead() const { return _new_dead; }
 75   size_t total() const { return dead() + _live; }
 76 };
 77 
 78 template<typename IsAlive, typename KeepAlive>
 79 void WeakProcessor::Task::work(uint worker_id,
 80                                IsAlive* is_alive,
 81                                KeepAlive* keep_alive) {
 82   assert(worker_id < _nworkers,
 83          "worker_id (%u) exceeds task's configured workers (%u)",
 84          worker_id, _nworkers);
 85 
 86   for (auto id : EnumRange<OopStorageSet::WeakId>()) {
 87     CountingClosure<IsAlive, KeepAlive> cl(is_alive, keep_alive);

 48   size_t _new_dead;
 49   size_t _live;
 50 
 51 public:
 52   CountingClosure(IsAlive* is_alive, KeepAlive* keep_alive) :
 53     _is_alive(is_alive),
 54     _keep_alive(keep_alive),
 55     _old_dead(0),
 56     _new_dead(0),
 57     _live(0)
 58   {}
 59 
 60   void do_oop(oop* p) {
 61     oop obj = *p;
 62     if (obj == NULL) {
 63       ++_old_dead;
 64     } else if (_is_alive->do_object_b(obj)) {
 65       _keep_alive->do_oop(p);
 66       ++_live;
 67     } else {
 68       ObjectMonitor::maybe_deflate_dead(p);
 69       *p = NULL;
 70       ++_new_dead;
 71     }
 72   }
 73 
 74   size_t dead() const { return _old_dead + _new_dead; }
 75   size_t new_dead() const { return _new_dead; }
 76   size_t total() const { return dead() + _live; }
 77 };
 78 
 79 template<typename IsAlive, typename KeepAlive>
 80 void WeakProcessor::Task::work(uint worker_id,
 81                                IsAlive* is_alive,
 82                                KeepAlive* keep_alive) {
 83   assert(worker_id < _nworkers,
 84          "worker_id (%u) exceeds task's configured workers (%u)",
 85          worker_id, _nworkers);
 86 
 87   for (auto id : EnumRange<OopStorageSet::WeakId>()) {
 88     CountingClosure<IsAlive, KeepAlive> cl(is_alive, keep_alive);
< prev index next >