714 checked_cast<u2>(info.index()), checked_cast<u1>(state),
715 static_cast<u1>(get_code), static_cast<u1>(put_code));
716 }
717
718
719 //------------------------------------------------------------------------------------------------------------------------
720 // Synchronization
721 //
722 // The interpreter's synchronization code is factored out so that it can
723 // be shared by method invocation and synchronized blocks.
724 //%note synchronization_3
725
726 //%note monitor_1
727 JRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* current, BasicObjectLock* elem))
728 #ifdef ASSERT
729 current->last_frame().interpreter_frame_verify_monitor(elem);
730 #endif
731 Handle h_obj(current, elem->obj());
732 assert(Universe::heap()->is_in_or_null(h_obj()),
733 "must be null or an object");
734 ObjectSynchronizer::enter(h_obj, elem->lock(), current);
735 assert(Universe::heap()->is_in_or_null(elem->obj()),
736 "must be null or an object");
737 #ifdef ASSERT
738 current->last_frame().interpreter_frame_verify_monitor(elem);
739 #endif
740 JRT_END
741
742 JRT_LEAF(void, InterpreterRuntime::monitorexit(BasicObjectLock* elem))
743 oop obj = elem->obj();
744 assert(Universe::heap()->is_in(obj), "must be an object");
745 // The object could become unlocked through a JNI call, which we have no other checks for.
746 // Give a fatal message if CheckJNICalls. Otherwise we ignore it.
747 if (obj->is_unlocked()) {
748 if (CheckJNICalls) {
749 fatal("Object has been unlocked by JNI");
750 }
751 return;
752 }
753 ObjectSynchronizer::exit(obj, elem->lock(), JavaThread::current());
754 // Free entry. If it is not cleared, the exception handling code will try to unlock the monitor
755 // again at method exit or in the case of an exception.
756 elem->set_obj(nullptr);
757 JRT_END
758
|
714 checked_cast<u2>(info.index()), checked_cast<u1>(state),
715 static_cast<u1>(get_code), static_cast<u1>(put_code));
716 }
717
718
719 //------------------------------------------------------------------------------------------------------------------------
720 // Synchronization
721 //
722 // The interpreter's synchronization code is factored out so that it can
723 // be shared by method invocation and synchronized blocks.
724 //%note synchronization_3
725
726 //%note monitor_1
727 JRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* current, BasicObjectLock* elem))
728 #ifdef ASSERT
729 current->last_frame().interpreter_frame_verify_monitor(elem);
730 #endif
731 Handle h_obj(current, elem->obj());
732 assert(Universe::heap()->is_in_or_null(h_obj()),
733 "must be null or an object");
734 ThreadOnMonitorEnter tme(current);
735 ObjectSynchronizer::enter(h_obj, elem->lock(), current);
736 assert(Universe::heap()->is_in_or_null(elem->obj()),
737 "must be null or an object");
738 #ifdef ASSERT
739 if (!current->preempting()) current->last_frame().interpreter_frame_verify_monitor(elem);
740 #endif
741 JRT_END
742
743 JRT_LEAF(void, InterpreterRuntime::monitorexit(BasicObjectLock* elem))
744 oop obj = elem->obj();
745 assert(Universe::heap()->is_in(obj), "must be an object");
746 // The object could become unlocked through a JNI call, which we have no other checks for.
747 // Give a fatal message if CheckJNICalls. Otherwise we ignore it.
748 if (obj->is_unlocked()) {
749 if (CheckJNICalls) {
750 fatal("Object has been unlocked by JNI");
751 }
752 return;
753 }
754 ObjectSynchronizer::exit(obj, elem->lock(), JavaThread::current());
755 // Free entry. If it is not cleared, the exception handling code will try to unlock the monitor
756 // again at method exit or in the case of an exception.
757 elem->set_obj(nullptr);
758 JRT_END
759
|