< prev index next >

src/hotspot/share/runtime/sharedRuntime.cpp

Print this page
*** 61,10 ***
--- 61,11 ---
  #include "runtime/init.hpp"
  #include "runtime/interfaceSupport.inline.hpp"
  #include "runtime/java.hpp"
  #include "runtime/javaCalls.hpp"
  #include "runtime/jniHandles.inline.hpp"
+ #include "runtime/objectMonitor.inline.hpp"
  #include "runtime/sharedRuntime.hpp"
  #include "runtime/stackWatermarkSet.hpp"
  #include "runtime/stubRoutines.hpp"
  #include "runtime/synchronizer.hpp"
  #include "runtime/vframe.inline.hpp"

*** 1917,20 ***
--- 1918,29 ---
    // would leave you with the lock held and it would never be released.
    // The normal monitorenter NullPointerException is thrown without acquiring a lock
    // and the model is that an exception implies the method failed.
    JRT_BLOCK_NO_ASYNC
    Handle h_obj(THREAD, obj);
+   ThreadOnMonitorEnter tme(current);
    ObjectSynchronizer::enter(h_obj, lock, current);
    assert(!HAS_PENDING_EXCEPTION, "Should have no exception here");
    JRT_BLOCK_END
  }
  
  // Handles the uncommon case in locking, i.e., contention or an inflated lock.
  JRT_BLOCK_ENTRY(void, SharedRuntime::complete_monitor_locking_C(oopDesc* obj, BasicLock* lock, JavaThread* current))
    SharedRuntime::monitor_enter_helper(obj, lock, current);
  JRT_END
  
+ JRT_LEAF(void, SharedRuntime::redo_monitorenter(JavaThread* current, ObjectMonitor* monitor))
+   assert(current == JavaThread::current(), "invariant");
+   assert(!monitor->is_owner(current), "invariant");
+ 
+   monitor->redo_enter(current);
+   assert(monitor->is_owner(current) || current->preempting(), "invariant");
+ JRT_END
+ 
  void SharedRuntime::monitor_exit_helper(oopDesc* obj, BasicLock* lock, JavaThread* current) {
    assert(JavaThread::current() == current, "invariant");
    // Exit must be non-blocking, and therefore no exceptions can be thrown.
    ExceptionMark em(current);
    // The object could become unlocked through a JNI call, which we have no other checks for.
< prev index next >