8259068: Streamline class loader locking

Reviewed-by: dcubed, iklam
This commit is contained in:
Coleen Phillimore 2021-01-15 17:47:33 +00:00
parent 27a39c8d3f
commit 9aa5672af0
6 changed files with 47 additions and 102 deletions

View file

@ -647,19 +647,18 @@ void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) {
// -----------------------------------------------------------------------------
// Internal VM locks on java objects
// standard constructor, allows locking failures
ObjectLocker::ObjectLocker(Handle obj, Thread* thread, bool do_lock) {
_dolock = do_lock;
ObjectLocker::ObjectLocker(Handle obj, Thread* thread) {
_thread = thread;
_thread->check_for_valid_safepoint_state();
_obj = obj;
if (_dolock) {
if (_obj() != NULL) {
ObjectSynchronizer::enter(_obj, &_lock, _thread);
}
}
ObjectLocker::~ObjectLocker() {
if (_dolock) {
if (_obj() != NULL) {
ObjectSynchronizer::exit(_obj(), &_lock, _thread);
}
}