412 // the current locking is from JNI instead of Java code
413 if (UseBiasedLocking) {
414 BiasedLocking::revoke_and_rebias(obj, false, THREAD);
415 assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
416 }
417 THREAD->set_current_pending_monitor_is_from_java(false);
418 inflate(THREAD, obj(), inflate_cause_jni_enter)->enter(THREAD);
419 THREAD->set_current_pending_monitor_is_from_java(true);
420 }
421
422 // NOTE: must use heavy weight monitor to handle jni monitor exit
423 void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) {
424 if (UseBiasedLocking) {
425 Handle h_obj(THREAD, obj);
426 BiasedLocking::revoke_and_rebias(h_obj, false, THREAD);
427 obj = h_obj();
428 }
429 assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
430
431 ObjectMonitor* monitor = inflate(THREAD, obj, inflate_cause_jni_exit);
432 // If this thread has locked the object, exit the monitor. Note: can't use
433 // monitor->check(CHECK); must exit even if an exception is pending.
434 if (monitor->check(THREAD)) {
435 monitor->exit(true, THREAD);
436 }
437 }
438
439 // -----------------------------------------------------------------------------
440 // Internal VM locks on java objects
441 // standard constructor, allows locking failures
442 ObjectLocker::ObjectLocker(Handle obj, Thread* thread, bool doLock) {
443 _dolock = doLock;
444 _thread = thread;
445 _thread->check_for_valid_safepoint_state(false);
446 _obj = obj;
447
448 if (_dolock) {
449 ObjectSynchronizer::fast_enter(_obj, &_lock, false, _thread);
450 }
451 }
452
453 ObjectLocker::~ObjectLocker() {
454 if (_dolock) {
|
412 // the current locking is from JNI instead of Java code
413 if (UseBiasedLocking) {
414 BiasedLocking::revoke_and_rebias(obj, false, THREAD);
415 assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
416 }
417 THREAD->set_current_pending_monitor_is_from_java(false);
418 inflate(THREAD, obj(), inflate_cause_jni_enter)->enter(THREAD);
419 THREAD->set_current_pending_monitor_is_from_java(true);
420 }
421
422 // NOTE: must use heavy weight monitor to handle jni monitor exit
423 void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) {
424 if (UseBiasedLocking) {
425 Handle h_obj(THREAD, obj);
426 BiasedLocking::revoke_and_rebias(h_obj, false, THREAD);
427 obj = h_obj();
428 }
429 assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
430
431 ObjectMonitor* monitor = inflate(THREAD, obj, inflate_cause_jni_exit);
432 // If this thread has locked the object, exit the monitor. We
433 // intentionally do not use CHECK here because we must exit the
434 // monitor even if an exception is pending.
435 if (monitor->check_owner_and_throw_IMSE_if_not(THREAD)) {
436 monitor->exit(true, THREAD);
437 }
438 }
439
440 // -----------------------------------------------------------------------------
441 // Internal VM locks on java objects
442 // standard constructor, allows locking failures
443 ObjectLocker::ObjectLocker(Handle obj, Thread* thread, bool doLock) {
444 _dolock = doLock;
445 _thread = thread;
446 _thread->check_for_valid_safepoint_state(false);
447 _obj = obj;
448
449 if (_dolock) {
450 ObjectSynchronizer::fast_enter(_obj, &_lock, false, _thread);
451 }
452 }
453
454 ObjectLocker::~ObjectLocker() {
455 if (_dolock) {
|