8041468: Field nmethod::_lock_count should be declared volatile

The jint field nmethod::_lock_count which is used in nmethodLocker::lock_nmethod and nmethodLocker::unlock_nmethod should be declared volatile (see also signature of Atomic::inc)

Reviewed-by: kvn, roland
This commit is contained in:
Tobias Hartmann 2014-04-24 09:47:34 +02:00 committed by Albert Noll
parent 26de6296e0
commit d16c89c108
3 changed files with 4 additions and 4 deletions

View file

@ -2284,13 +2284,13 @@ nmethodLocker::nmethodLocker(address pc) {
void nmethodLocker::lock_nmethod(nmethod* nm, bool zombie_ok) {
if (nm == NULL) return;
Atomic::inc(&nm->_lock_count);
guarantee(zombie_ok || !nm->is_zombie(), "cannot lock a zombie method");
assert(zombie_ok || !nm->is_zombie(), "cannot lock a zombie method");
}
void nmethodLocker::unlock_nmethod(nmethod* nm) {
if (nm == NULL) return;
Atomic::dec(&nm->_lock_count);
guarantee(nm->_lock_count >= 0, "unmatched nmethod lock/unlock");
assert(nm->_lock_count >= 0, "unmatched nmethod lock/unlock");
}