< prev index next >

src/hotspot/share/interpreter/interpreterRuntime.cpp

Print this page

 710     get_code,
 711     put_code,
 712     info.field_holder(),
 713     info.index(),
 714     info.offset(),
 715     state,
 716     info.access_flags().is_final(),
 717     info.access_flags().is_volatile()
 718   );
 719 }
 720 
 721 
 722 //------------------------------------------------------------------------------------------------------------------------
 723 // Synchronization
 724 //
 725 // The interpreter's synchronization code is factored out so that it can
 726 // be shared by method invocation and synchronized blocks.
 727 //%note synchronization_3
 728 
 729 //%note monitor_1
 730 JRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* current, BasicObjectLock* elem))
 731 #ifdef ASSERT
 732   current->last_frame().interpreter_frame_verify_monitor(elem);
 733 #endif
 734   Handle h_obj(current, elem->obj());
 735   assert(Universe::heap()->is_in_or_null(h_obj()),
 736          "must be NULL or an object");
 737   ObjectSynchronizer::enter(h_obj, elem->lock(), current);
 738   assert(Universe::heap()->is_in_or_null(elem->obj()),
 739          "must be NULL or an object");
 740 #ifdef ASSERT
 741   current->last_frame().interpreter_frame_verify_monitor(elem);
 742 #endif
 743 JRT_END
 744 
 745 
 746 JRT_LEAF(void, InterpreterRuntime::monitorexit(BasicObjectLock* elem))
 747   oop obj = elem->obj();
 748   assert(Universe::heap()->is_in(obj), "must be an object");
 749   // The object could become unlocked through a JNI call, which we have no other checks for.
 750   // Give a fatal message if CheckJNICalls. Otherwise we ignore it.
 751   if (obj->is_unlocked()) {
 752     if (CheckJNICalls) {
 753       fatal("Object has been unlocked by JNI");
 754     }
 755     return;
 756   }
 757   ObjectSynchronizer::exit(obj, elem->lock(), JavaThread::current());
 758   // Free entry. If it is not cleared, the exception handling code will try to unlock the monitor
 759   // again at method exit or in the case of an exception.
 760   elem->set_obj(NULL);
 761 JRT_END
 762 
 763 
 764 JRT_ENTRY(void, InterpreterRuntime::throw_illegal_monitor_state_exception(JavaThread* current))
 765   THROW(vmSymbols::java_lang_IllegalMonitorStateException());
 766 JRT_END
 767 
 768 
 769 JRT_ENTRY(void, InterpreterRuntime::new_illegal_monitor_state_exception(JavaThread* current))
 770   // Returns an illegal exception to install into the current thread. The
 771   // pending_exception flag is cleared so normal exception handling does not
 772   // trigger. Any current installed exception will be overwritten. This
 773   // method will be called during an exception unwind.
 774 
 775   assert(!HAS_PENDING_EXCEPTION, "no pending exception");
 776   Handle exception(current, current->vm_result());
 777   assert(exception() != NULL, "vm result should be set");
 778   current->set_vm_result(NULL); // clear vm result before continuing (may cause memory leaks and assert failures)
 779   exception = get_preinitialized_exception(vmClasses::IllegalMonitorStateException_klass(), CATCH);
 780   current->set_vm_result(exception());

 710     get_code,
 711     put_code,
 712     info.field_holder(),
 713     info.index(),
 714     info.offset(),
 715     state,
 716     info.access_flags().is_final(),
 717     info.access_flags().is_volatile()
 718   );
 719 }
 720 
 721 
 722 //------------------------------------------------------------------------------------------------------------------------
 723 // Synchronization
 724 //
 725 // The interpreter's synchronization code is factored out so that it can
 726 // be shared by method invocation and synchronized blocks.
 727 //%note synchronization_3
 728 
 729 //%note monitor_1
 730 JRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* current, oopDesc* obj))
 731   Handle h_obj(current, obj);



 732   assert(Universe::heap()->is_in_or_null(h_obj()),
 733          "must be NULL or an object");
 734   ObjectSynchronizer::enter(h_obj, current);
 735   assert(Universe::heap()->is_in_or_null(h_obj()),
 736          "must be NULL or an object");



 737 JRT_END
 738 
 739 
 740 JRT_LEAF(void, InterpreterRuntime::monitorexit(oopDesc* o))
 741   oop obj = oop(o);
 742   assert(Universe::heap()->is_in(obj), "must be an object");
 743   // The object could become unlocked through a JNI call, which we have no other checks for.
 744   // Give a fatal message if CheckJNICalls. Otherwise we ignore it.
 745   if (obj->is_unlocked()) {
 746     if (CheckJNICalls) {
 747       fatal("Object has been unlocked by JNI");
 748     }
 749     return;
 750   }
 751   ObjectSynchronizer::exit(obj, JavaThread::current());



 752 JRT_END
 753 
 754 
 755 JRT_ENTRY(void, InterpreterRuntime::throw_illegal_monitor_state_exception(JavaThread* current))
 756   THROW(vmSymbols::java_lang_IllegalMonitorStateException());
 757 JRT_END
 758 
 759 
 760 JRT_ENTRY(void, InterpreterRuntime::new_illegal_monitor_state_exception(JavaThread* current))
 761   // Returns an illegal exception to install into the current thread. The
 762   // pending_exception flag is cleared so normal exception handling does not
 763   // trigger. Any current installed exception will be overwritten. This
 764   // method will be called during an exception unwind.
 765 
 766   assert(!HAS_PENDING_EXCEPTION, "no pending exception");
 767   Handle exception(current, current->vm_result());
 768   assert(exception() != NULL, "vm result should be set");
 769   current->set_vm_result(NULL); // clear vm result before continuing (may cause memory leaks and assert failures)
 770   exception = get_preinitialized_exception(vmClasses::IllegalMonitorStateException_klass(), CATCH);
 771   current->set_vm_result(exception());
< prev index next >