< prev index next >
src/hotspot/share/gc/z/zUnload.cpp
return _is_unloading;
}
};
class ZIsUnloadingBehaviour : public IsUnloadingBehaviour {
- private:
- bool is_unloading(nmethod* nm) const {
- ZIsUnloadingOopClosure cl;
- nm->oops_do(&cl, true /* allow_zombie */);
- return cl.is_unloading();
- }
-
public:
virtual bool is_unloading(CompiledMethod* method) const {
nmethod* const nm = method->as_nmethod();
ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
! if (lock == NULL) {
! return is_unloading(nm);
! } else {
! ZLocker<ZReentrantLock> locker(lock);
! return is_unloading(nm);
! }
}
};
class ZCompiledICProtectionBehaviour : public CompiledICProtectionBehaviour {
public:
virtual bool lock(CompiledMethod* method) {
nmethod* const nm = method->as_nmethod();
ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
! if (lock != NULL) {
! lock->lock();
! }
return true;
}
virtual void unlock(CompiledMethod* method) {
nmethod* const nm = method->as_nmethod();
ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
! if (lock != NULL) {
! lock->unlock();
! }
}
virtual bool is_safe(CompiledMethod* method) {
if (SafepointSynchronize::is_at_safepoint()) {
return true;
}
nmethod* const nm = method->as_nmethod();
ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
! return lock == NULL || lock->is_owned();
}
};
ZUnload::ZUnload(ZWorkers* workers) :
_workers(workers) {
return _is_unloading;
}
};
class ZIsUnloadingBehaviour : public IsUnloadingBehaviour {
public:
virtual bool is_unloading(CompiledMethod* method) const {
nmethod* const nm = method->as_nmethod();
ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
! ZLocker<ZReentrantLock> locker(lock);
! ZIsUnloadingOopClosure cl;
! nm->oops_do(&cl, true /* allow_zombie */);
! return cl.is_unloading();
}
};
class ZCompiledICProtectionBehaviour : public CompiledICProtectionBehaviour {
public:
virtual bool lock(CompiledMethod* method) {
nmethod* const nm = method->as_nmethod();
ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
! lock->lock();
return true;
}
virtual void unlock(CompiledMethod* method) {
nmethod* const nm = method->as_nmethod();
ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
! lock->unlock();
}
virtual bool is_safe(CompiledMethod* method) {
if (SafepointSynchronize::is_at_safepoint()) {
return true;
}
nmethod* const nm = method->as_nmethod();
ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
! return lock->is_owned();
}
};
ZUnload::ZUnload(ZWorkers* workers) :
_workers(workers) {
< prev index next >