src/hotspot/share/gc/g1/g1CollectedHeap.cpp
changeset 47765 b7c7428eaab9
parent 47760 c15f15bcc23e
child 47789 a77a7d3bc4f6
equal deleted inserted replaced
47764:029d5efaaa6c 47765:b7c7428eaab9
  3619 
  3619 
  3620 Monitor* G1CodeCacheUnloadingTask::_lock = new Monitor(Mutex::leaf, "Code Cache Unload lock", false, Monitor::_safepoint_check_never);
  3620 Monitor* G1CodeCacheUnloadingTask::_lock = new Monitor(Mutex::leaf, "Code Cache Unload lock", false, Monitor::_safepoint_check_never);
  3621 
  3621 
  3622 class G1KlassCleaningTask : public StackObj {
  3622 class G1KlassCleaningTask : public StackObj {
  3623   BoolObjectClosure*                      _is_alive;
  3623   BoolObjectClosure*                      _is_alive;
  3624   volatile jint                           _clean_klass_tree_claimed;
  3624   volatile int                            _clean_klass_tree_claimed;
  3625   ClassLoaderDataGraphKlassIteratorAtomic _klass_iterator;
  3625   ClassLoaderDataGraphKlassIteratorAtomic _klass_iterator;
  3626 
  3626 
  3627  public:
  3627  public:
  3628   G1KlassCleaningTask(BoolObjectClosure* is_alive) :
  3628   G1KlassCleaningTask(BoolObjectClosure* is_alive) :
  3629       _is_alive(is_alive),
  3629       _is_alive(is_alive),
  3635   bool claim_clean_klass_tree_task() {
  3635   bool claim_clean_klass_tree_task() {
  3636     if (_clean_klass_tree_claimed) {
  3636     if (_clean_klass_tree_claimed) {
  3637       return false;
  3637       return false;
  3638     }
  3638     }
  3639 
  3639 
  3640     return Atomic::cmpxchg(1, (jint*)&_clean_klass_tree_claimed, 0) == 0;
  3640     return Atomic::cmpxchg(1, &_clean_klass_tree_claimed, 0) == 0;
  3641   }
  3641   }
  3642 
  3642 
  3643   InstanceKlass* claim_next_klass() {
  3643   InstanceKlass* claim_next_klass() {
  3644     Klass* klass;
  3644     Klass* klass;
  3645     do {
  3645     do {
  3672   }
  3672   }
  3673 };
  3673 };
  3674 
  3674 
  3675 class G1ResolvedMethodCleaningTask : public StackObj {
  3675 class G1ResolvedMethodCleaningTask : public StackObj {
  3676   BoolObjectClosure* _is_alive;
  3676   BoolObjectClosure* _is_alive;
  3677   volatile jint      _resolved_method_task_claimed;
  3677   volatile int       _resolved_method_task_claimed;
  3678 public:
  3678 public:
  3679   G1ResolvedMethodCleaningTask(BoolObjectClosure* is_alive) :
  3679   G1ResolvedMethodCleaningTask(BoolObjectClosure* is_alive) :
  3680       _is_alive(is_alive), _resolved_method_task_claimed(0) {}
  3680       _is_alive(is_alive), _resolved_method_task_claimed(0) {}
  3681 
  3681 
  3682   bool claim_resolved_method_task() {
  3682   bool claim_resolved_method_task() {
  3683     if (_resolved_method_task_claimed) {
  3683     if (_resolved_method_task_claimed) {
  3684       return false;
  3684       return false;
  3685     }
  3685     }
  3686     return Atomic::cmpxchg(1, (jint*)&_resolved_method_task_claimed, 0) == 0;
  3686     return Atomic::cmpxchg(1, &_resolved_method_task_claimed, 0) == 0;
  3687   }
  3687   }
  3688 
  3688 
  3689   // These aren't big, one thread can do it all.
  3689   // These aren't big, one thread can do it all.
  3690   void work() {
  3690   void work() {
  3691     if (claim_resolved_method_task()) {
  3691     if (claim_resolved_method_task()) {