8319778: Remove unreachable code in ObjectSynchronizer::exit

Reviewed-by: rkennke, dholmes, pchilanomate, dcubed
This commit is contained in:
Axel Boldt-Christmas 2023-11-27 07:22:32 +00:00
parent 6aa197667a
commit 91279fcf05
3 changed files with 1 additions and 23 deletions

View File

@ -81,9 +81,6 @@ public:
// Pushes an oop on this lock-stack. // Pushes an oop on this lock-stack.
inline void push(oop o); inline void push(oop o);
// Pops an oop from this lock-stack.
inline oop pop();
// Removes an oop from an arbitrary location of this lock-stack. // Removes an oop from an arbitrary location of this lock-stack.
inline void remove(oop o); inline void remove(oop o);

View File

@ -68,19 +68,6 @@ inline void LockStack::push(oop o) {
verify("post-push"); verify("post-push");
} }
inline oop LockStack::pop() {
verify("pre-pop");
assert(to_index(_top) > 0, "underflow, probably unbalanced push/pop");
_top -= oopSize;
oop o = _base[to_index(_top)];
#ifdef ASSERT
_base[to_index(_top)] = nullptr;
#endif
assert(!contains(o), "entries must be unique: " PTR_FORMAT, p2i(o));
verify("post-pop");
return o;
}
inline void LockStack::remove(oop o) { inline void LockStack::remove(oop o) {
verify("pre-remove"); verify("pre-remove");
assert(contains(o), "entry must be present: " PTR_FORMAT, p2i(o)); assert(contains(o), "entry must be present: " PTR_FORMAT, p2i(o));

View File

@ -599,13 +599,7 @@ void ObjectSynchronizer::exit(oop object, BasicLock* lock, JavaThread* current)
// The ObjectMonitor* can't be async deflated until ownership is // The ObjectMonitor* can't be async deflated until ownership is
// dropped inside exit() and the ObjectMonitor* must be !is_busy(). // dropped inside exit() and the ObjectMonitor* must be !is_busy().
ObjectMonitor* monitor = inflate(current, object, inflate_cause_vm_internal); ObjectMonitor* monitor = inflate(current, object, inflate_cause_vm_internal);
if (LockingMode == LM_LIGHTWEIGHT && monitor->is_owner_anonymous()) { assert(!monitor->is_owner_anonymous(), "must not be");
// It must be owned by us. Pop lock object from lock stack.
LockStack& lock_stack = current->lock_stack();
oop popped = lock_stack.pop();
assert(popped == object, "must be owned by this thread");
monitor->set_owner_from_anonymous(current);
}
monitor->exit(current); monitor->exit(current);
} }