< prev index next >

src/hotspot/share/runtime/synchronizer.hpp

Print this page
*** 27,10 ***
--- 27,11 ---
  
  #include "memory/padded.hpp"
  #include "oops/markWord.hpp"
  #include "runtime/basicLock.hpp"
  #include "runtime/handles.hpp"
+ #include "runtime/javaThread.hpp"
  #include "utilities/resourceHash.hpp"
  
  template <typename T> class GrowableArray;
  class LogStream;
  class ObjectMonitor;

*** 90,12 ***
  
    // exit must be implemented non-blocking, since the compiler cannot easily handle
    // deoptimization at monitor exit. Hence, it does not take a Handle argument.
  
    // This is the "slow path" version of monitor enter and exit.
!   static void enter(Handle obj, BasicLock* lock, JavaThread* current);
!   static void exit(oop obj, BasicLock* lock, JavaThread* current);
    // Used to enter a monitor for another thread. This requires that the
    // locking_thread is suspended, and that entering on a potential
    // inflated monitor may only contend with deflation. That is the obj being
    // locked on is either already locked by the locking_thread or cannot
    // escape the locking_thread.
--- 91,13 ---
  
    // exit must be implemented non-blocking, since the compiler cannot easily handle
    // deoptimization at monitor exit. Hence, it does not take a Handle argument.
  
    // This is the "slow path" version of monitor enter and exit.
!   static inline void enter(Handle obj, BasicLock* lock, JavaThread* current);
!   static inline void exit(oop obj, BasicLock* lock, JavaThread* current);
+ 
    // Used to enter a monitor for another thread. This requires that the
    // locking_thread is suspended, and that entering on a potential
    // inflated monitor may only contend with deflation. That is the obj being
    // locked on is either already locked by the locking_thread or cannot
    // escape the locking_thread.

*** 103,10 ***
--- 105,13 ---
  private:
    // Shared implementation for enter and enter_for. Performs all but
    // inflated monitor enter.
    static bool enter_fast_impl(Handle obj, BasicLock* lock, JavaThread* locking_thread);
  
+   static bool quick_enter_legacy(oop obj, JavaThread* current, BasicLock* Lock);
+   static void enter_legacy(Handle obj, BasicLock* Lock, JavaThread* current);
+   static void exit_legacy(oop obj, BasicLock* lock, JavaThread* current);
  public:
    // Used only to handle jni locks or other unmatched monitor enter/exit
    // Internally they will use heavy weight monitor.
    static void jni_enter(Handle obj, JavaThread* current);
    static void jni_exit(oop obj, TRAPS);

*** 115,26 ***
    static int  wait(Handle obj, jlong millis, TRAPS);
    static void notify(Handle obj, TRAPS);
    static void notifyall(Handle obj, TRAPS);
  
    static bool quick_notify(oopDesc* obj, JavaThread* current, bool All);
!   static bool quick_enter(oop obj, JavaThread* current, BasicLock* Lock);
  
    // Inflate light weight monitor to heavy weight monitor
    static ObjectMonitor* inflate(Thread* current, oop obj, const InflateCause cause);
    // Used to inflate a monitor as if it was done from the thread JavaThread.
    static ObjectMonitor* inflate_for(JavaThread* thread, oop obj, const InflateCause cause);
  
  private:
    // Shared implementation between the different LockingMode.
!   static ObjectMonitor* inflate_impl(JavaThread* thread, oop obj, const InflateCause cause);
  
  public:
    // This version is only for internal use
    static void inflate_helper(oop obj);
    static const char* inflate_cause_name(const InflateCause cause);
  
    // Returns the identity hash value for an oop
    // NOTE: It may cause monitor inflation
    static intptr_t FastHashCode(Thread* current, oop obj);
  
    // java.lang.Thread support
--- 120,29 ---
    static int  wait(Handle obj, jlong millis, TRAPS);
    static void notify(Handle obj, TRAPS);
    static void notifyall(Handle obj, TRAPS);
  
    static bool quick_notify(oopDesc* obj, JavaThread* current, bool All);
!   static inline bool quick_enter(oop obj, JavaThread* current, BasicLock* Lock);
  
    // Inflate light weight monitor to heavy weight monitor
    static ObjectMonitor* inflate(Thread* current, oop obj, const InflateCause cause);
    // Used to inflate a monitor as if it was done from the thread JavaThread.
    static ObjectMonitor* inflate_for(JavaThread* thread, oop obj, const InflateCause cause);
  
  private:
    // Shared implementation between the different LockingMode.
!   static ObjectMonitor* inflate_impl(oop obj, const InflateCause cause);
  
  public:
    // This version is only for internal use
    static void inflate_helper(oop obj);
    static const char* inflate_cause_name(const InflateCause cause);
  
+   inline static ObjectMonitor* read_monitor(markWord mark);
+   inline static ObjectMonitor* read_monitor(Thread* current, oop obj, markWord mark);
+ 
    // Returns the identity hash value for an oop
    // NOTE: It may cause monitor inflation
    static intptr_t FastHashCode(Thread* current, oop obj);
  
    // java.lang.Thread support

*** 192,10 ***
--- 200,11 ---
    static void do_final_audit_and_print_stats();
    static void log_in_use_monitor_details(outputStream* out, bool log_all);
  
   private:
    friend class SynchronizerTest;
+   friend class LightweightSynchronizer;
  
    static MonitorList _in_use_list;
    static volatile bool _is_async_deflation_requested;
    static volatile bool _is_final_audit;
    static jlong         _last_async_deflation_time_ns;
< prev index next >