< prev index next >

src/hotspot/share/runtime/sharedRuntime.cpp

Print this page
*** 2186,35 ***
  
  JRT_LEAF(void, SharedRuntime::reguard_yellow_pages())
    (void) JavaThread::current()->stack_overflow_state()->reguard_stack();
  JRT_END
  
! void SharedRuntime::monitor_enter_helper(oopDesc* obj, BasicLock* lock, JavaThread* current) {
    if (!SafepointSynchronize::is_synchronizing()) {
      // Only try quick_enter() if we're not trying to reach a safepoint
      // so that the calling thread reaches the safepoint more quickly.
!     if (ObjectSynchronizer::quick_enter(obj, current, lock)) {
        return;
      }
    }
    // NO_ASYNC required because an async exception on the state transition destructor
    // 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);
!   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
  
! 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.
    // Give a fatal message if CheckJNICalls. Otherwise we ignore it.
--- 2186,35 ---
  
  JRT_LEAF(void, SharedRuntime::reguard_yellow_pages())
    (void) JavaThread::current()->stack_overflow_state()->reguard_stack();
  JRT_END
  
! void SharedRuntime::monitor_enter_helper(oopDesc* obj, JavaThread* current) {
    if (!SafepointSynchronize::is_synchronizing()) {
      // Only try quick_enter() if we're not trying to reach a safepoint
      // so that the calling thread reaches the safepoint more quickly.
!     if (ObjectSynchronizer::quick_enter(obj, current)) {
        return;
      }
    }
    // NO_ASYNC required because an async exception on the state transition destructor
    // 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);
!   ObjectSynchronizer::enter(h_obj, 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, JavaThread* current))
!   SharedRuntime::monitor_enter_helper(obj, current);
  JRT_END
  
! void SharedRuntime::monitor_exit_helper(oopDesc* obj, 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.
    // Give a fatal message if CheckJNICalls. Otherwise we ignore it.

*** 2222,16 ***
      if (CheckJNICalls) {
        fatal("Object has been unlocked by JNI");
      }
      return;
    }
!   ObjectSynchronizer::exit(obj, lock, current);
  }
  
  // Handles the uncommon cases of monitor unlocking in compiled code
! JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* obj, BasicLock* lock, JavaThread* current))
!   SharedRuntime::monitor_exit_helper(obj, lock, current);
  JRT_END
  
  #ifndef PRODUCT
  
  void SharedRuntime::print_statistics() {
--- 2222,16 ---
      if (CheckJNICalls) {
        fatal("Object has been unlocked by JNI");
      }
      return;
    }
!   ObjectSynchronizer::exit(obj, current);
  }
  
  // Handles the uncommon cases of monitor unlocking in compiled code
! JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* obj, JavaThread* current))
!   SharedRuntime::monitor_exit_helper(obj, current);
  JRT_END
  
  #ifndef PRODUCT
  
  void SharedRuntime::print_statistics() {

*** 3224,25 ***
    int i = max_locals;
    for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
         kptr2 < fr.interpreter_frame_monitor_begin();
         kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
      if (kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
-       BasicLock *lock = kptr2->lock();
-       // Inflate so the object's header no longer refers to the BasicLock.
-       if (lock->displaced_header().is_unlocked()) {
-         // The object is locked and the resulting ObjectMonitor* will also be
-         // locked so it can't be async deflated until ownership is dropped.
-         // See the big comment in basicLock.cpp: BasicLock::move_to().
-         ObjectSynchronizer::inflate_helper(kptr2->obj());
-       }
-       // Now the displaced header is free to move because the
-       // object's header no longer refers to it.
-       buf[i++] = (intptr_t)lock->displaced_header().value();
        buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
      }
    }
!   assert(i - max_locals == active_monitor_count*2, "found the expected number of monitors");
  
    RegisterMap map(current,
                    RegisterMap::UpdateMap::skip,
                    RegisterMap::ProcessFrames::include,
                    RegisterMap::WalkContinuation::skip);
--- 3224,14 ---
    int i = max_locals;
    for (BasicObjectLock *kptr2 = fr.interpreter_frame_monitor_end();
         kptr2 < fr.interpreter_frame_monitor_begin();
         kptr2 = fr.next_monitor_in_interpreter_frame(kptr2) ) {
      if (kptr2->obj() != NULL) {         // Avoid 'holes' in the monitor array
        buf[i++] = cast_from_oop<intptr_t>(kptr2->obj());
      }
    }
!   assert(i - max_locals == active_monitor_count, "found the expected number of monitors");
  
    RegisterMap map(current,
                    RegisterMap::UpdateMap::skip,
                    RegisterMap::ProcessFrames::include,
                    RegisterMap::WalkContinuation::skip);
< prev index next >