hotspot/src/share/vm/runtime/sharedRuntime.cpp
changeset 29070 b0a5fc9c59c8
parent 28947 2ea471384931
child 30305 b92a97e1e9cb
child 30244 d4e471395ff5
equal deleted inserted replaced
29069:938c1c97ad3b 29070:b0a5fc9c59c8
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
  1790   (void) JavaThread::current()->reguard_stack();
  1790   (void) JavaThread::current()->reguard_stack();
  1791 JRT_END
  1791 JRT_END
  1792 
  1792 
  1793 
  1793 
  1794 // Handles the uncommon case in locking, i.e., contention or an inflated lock.
  1794 // Handles the uncommon case in locking, i.e., contention or an inflated lock.
  1795 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::complete_monitor_locking_C(oopDesc* _obj, BasicLock* lock, JavaThread* thread))
  1795 JRT_BLOCK_ENTRY(void, SharedRuntime::complete_monitor_locking_C(oopDesc* _obj, BasicLock* lock, JavaThread* thread))
       
  1796   if (!SafepointSynchronize::is_synchronizing()) {
       
  1797     // Only try quick_enter() if we're not trying to reach a safepoint
       
  1798     // so that the calling thread reaches the safepoint more quickly.
       
  1799     if (ObjectSynchronizer::quick_enter(_obj, thread, lock)) return;
       
  1800   }
       
  1801   // NO_ASYNC required because an async exception on the state transition destructor
       
  1802   // would leave you with the lock held and it would never be released.
       
  1803   // The normal monitorenter NullPointerException is thrown without acquiring a lock
       
  1804   // and the model is that an exception implies the method failed.
       
  1805   JRT_BLOCK_NO_ASYNC
  1796   oop obj(_obj);
  1806   oop obj(_obj);
  1797   if (PrintBiasedLockingStatistics) {
  1807   if (PrintBiasedLockingStatistics) {
  1798     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
  1808     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
  1799   }
  1809   }
  1800   Handle h_obj(THREAD, obj);
  1810   Handle h_obj(THREAD, obj);
  1803     ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
  1813     ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
  1804   } else {
  1814   } else {
  1805     ObjectSynchronizer::slow_enter(h_obj, lock, CHECK);
  1815     ObjectSynchronizer::slow_enter(h_obj, lock, CHECK);
  1806   }
  1816   }
  1807   assert(!HAS_PENDING_EXCEPTION, "Should have no exception here");
  1817   assert(!HAS_PENDING_EXCEPTION, "Should have no exception here");
       
  1818   JRT_BLOCK_END
  1808 JRT_END
  1819 JRT_END
  1809 
  1820 
  1810 // Handles the uncommon cases of monitor unlocking in compiled code
  1821 // Handles the uncommon cases of monitor unlocking in compiled code
  1811 JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* _obj, BasicLock* lock))
  1822 JRT_LEAF(void, SharedRuntime::complete_monitor_unlocking_C(oopDesc* _obj, BasicLock* lock))
  1812    oop obj(_obj);
  1823    oop obj(_obj);