hotspot/src/share/vm/runtime/synchronizer.hpp
changeset 25069 c937c5e883c5
parent 22743 e043208c9d93
child 25472 381638db28e6
equal deleted inserted replaced
25068:de4b1c96dca3 25069:c937c5e883c5
    73   static void notifyall          (Handle obj,               TRAPS);
    73   static void notifyall          (Handle obj,               TRAPS);
    74 
    74 
    75   // Special internal-use-only method for use by JVM infrastructure
    75   // Special internal-use-only method for use by JVM infrastructure
    76   // that needs to wait() on a java-level object but that can't risk
    76   // that needs to wait() on a java-level object but that can't risk
    77   // throwing unexpected InterruptedExecutionExceptions.
    77   // throwing unexpected InterruptedExecutionExceptions.
    78   static void waitUninterruptibly (Handle obj, jlong Millis, Thread * THREAD) ;
    78   static void waitUninterruptibly(Handle obj, jlong Millis, Thread * THREAD);
    79 
    79 
    80   // used by classloading to free classloader object lock,
    80   // used by classloading to free classloader object lock,
    81   // wait on an internal lock, and reclaim original lock
    81   // wait on an internal lock, and reclaim original lock
    82   // with original recursion count
    82   // with original recursion count
    83   static intptr_t complete_exit  (Handle obj,                TRAPS);
    83   static intptr_t complete_exit  (Handle obj,                TRAPS);
    84   static void reenter            (Handle obj, intptr_t recursion, TRAPS);
    84   static void reenter            (Handle obj, intptr_t recursion, TRAPS);
    85 
    85 
    86   // thread-specific and global objectMonitor free list accessors
    86   // thread-specific and global objectMonitor free list accessors
    87 //  static void verifyInUse (Thread * Self) ; too slow for general assert/debug
    87 //  static void verifyInUse (Thread * Self) ; too slow for general assert/debug
    88   static ObjectMonitor * omAlloc (Thread * Self) ;
    88   static ObjectMonitor * omAlloc(Thread * Self);
    89   static void omRelease (Thread * Self, ObjectMonitor * m, bool FromPerThreadAlloc) ;
    89   static void omRelease(Thread * Self, ObjectMonitor * m, bool FromPerThreadAlloc);
    90   static void omFlush   (Thread * Self) ;
    90   static void omFlush(Thread * Self);
    91 
    91 
    92   // Inflate light weight monitor to heavy weight monitor
    92   // Inflate light weight monitor to heavy weight monitor
    93   static ObjectMonitor* inflate(Thread * Self, oop obj);
    93   static ObjectMonitor* inflate(Thread * Self, oop obj);
    94   // This version is only for internal use
    94   // This version is only for internal use
    95   static ObjectMonitor* inflate_helper(oop obj);
    95   static ObjectMonitor* inflate_helper(oop obj);
    96 
    96 
    97   // Returns the identity hash value for an oop
    97   // Returns the identity hash value for an oop
    98   // NOTE: It may cause monitor inflation
    98   // NOTE: It may cause monitor inflation
    99   static intptr_t identity_hash_value_for(Handle obj);
    99   static intptr_t identity_hash_value_for(Handle obj);
   100   static intptr_t FastHashCode (Thread * Self, oop obj) ;
   100   static intptr_t FastHashCode(Thread * Self, oop obj);
   101 
   101 
   102   // java.lang.Thread support
   102   // java.lang.Thread support
   103   static bool current_thread_holds_lock(JavaThread* thread, Handle h_obj);
   103   static bool current_thread_holds_lock(JavaThread* thread, Handle h_obj);
   104   static LockOwnership query_lock_ownership(JavaThread * self, Handle h_obj);
   104   static LockOwnership query_lock_ownership(JavaThread * self, Handle h_obj);
   105 
   105 
   122 
   122 
   123   // debugging
   123   // debugging
   124   static void verify() PRODUCT_RETURN;
   124   static void verify() PRODUCT_RETURN;
   125   static int  verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
   125   static int  verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;
   126 
   126 
   127   static void RegisterSpinCallback (int (*)(intptr_t, int), intptr_t) ;
   127   static void RegisterSpinCallback(int(*)(intptr_t, int), intptr_t);
   128 
   128 
   129  private:
   129  private:
   130   enum { _BLOCKSIZE = 128 };
   130   enum { _BLOCKSIZE = 128 };
   131   static ObjectMonitor* gBlockList;
   131   static ObjectMonitor* gBlockList;
   132   static ObjectMonitor * volatile gFreeList;
   132   static ObjectMonitor * volatile gFreeList;
   153   ~ObjectLocker();
   153   ~ObjectLocker();
   154 
   154 
   155   // Monitor behavior
   155   // Monitor behavior
   156   void wait      (TRAPS)      { ObjectSynchronizer::wait     (_obj, 0, CHECK); } // wait forever
   156   void wait      (TRAPS)      { ObjectSynchronizer::wait     (_obj, 0, CHECK); } // wait forever
   157   void notify_all(TRAPS)      { ObjectSynchronizer::notifyall(_obj,    CHECK); }
   157   void notify_all(TRAPS)      { ObjectSynchronizer::notifyall(_obj,    CHECK); }
   158   void waitUninterruptibly (TRAPS) { ObjectSynchronizer::waitUninterruptibly (_obj, 0, CHECK);}
   158   void waitUninterruptibly (TRAPS) { ObjectSynchronizer::waitUninterruptibly (_obj, 0, CHECK); }
   159   // complete_exit gives up lock completely, returning recursion count
   159   // complete_exit gives up lock completely, returning recursion count
   160   // reenter reclaims lock with original recursion count
   160   // reenter reclaims lock with original recursion count
   161   intptr_t complete_exit(TRAPS) { return  ObjectSynchronizer::complete_exit(_obj, CHECK_0); }
   161   intptr_t complete_exit(TRAPS) { return  ObjectSynchronizer::complete_exit(_obj, CHECK_0); }
   162   void reenter(intptr_t recursion, TRAPS) { ObjectSynchronizer::reenter(_obj, recursion, CHECK); }
   162   void reenter(intptr_t recursion, TRAPS) { ObjectSynchronizer::reenter(_obj, recursion, CHECK); }
   163 };
   163 };