48 typedef enum { 49 owner_self, 50 owner_none, 51 owner_other 52 } LockOwnership; 53 54 typedef enum { 55 inflate_cause_vm_internal = 0, 56 inflate_cause_monitor_enter = 1, 57 inflate_cause_wait = 2, 58 inflate_cause_notify = 3, 59 inflate_cause_hash_code = 4, 60 inflate_cause_jni_enter = 5, 61 inflate_cause_jni_exit = 6, 62 inflate_cause_nof = 7 // Number of causes 63 } InflateCause; 64 65 // exit must be implemented non-blocking, since the compiler cannot easily handle 66 // deoptimization at monitor exit. Hence, it does not take a Handle argument. 67 68 // This is full version of monitor enter and exit. I choose not 69 // to use enter() and exit() in order to make sure user be ware 70 // of the performance and semantics difference. They are normally 71 // used by ObjectLocker etc. The interpreter and compiler use 72 // assembly copies of these routines. Please keep them synchronized. 73 // 74 // attempt_rebias flag is used by UseBiasedLocking implementation 75 static void fast_enter(Handle obj, BasicLock* lock, bool attempt_rebias, 76 TRAPS); 77 static void fast_exit(oop obj, BasicLock* lock, Thread* THREAD); 78 79 // WARNING: They are ONLY used to handle the slow cases. They should 80 // only be used when the fast cases failed. Use of these functions 81 // without previous fast case check may cause fatal error. 82 static void slow_enter(Handle obj, BasicLock* lock, TRAPS); 83 static void slow_exit(oop obj, BasicLock* lock, Thread* THREAD); 84 85 // Used only to handle jni locks or other unmatched monitor enter/exit 86 // Internally they will use heavy weight monitor. 87 static void jni_enter(Handle obj, TRAPS); 88 static void jni_exit(oop obj, Thread* THREAD); 89 90 // Handle all interpreter, compiler and jni cases 91 static int wait(Handle obj, jlong millis, TRAPS); 92 static void notify(Handle obj, TRAPS); 93 static void notifyall(Handle obj, TRAPS); 94 95 static bool quick_notify(oopDesc* obj, Thread* Self, bool All); 96 static bool quick_enter(oop obj, Thread* Self, BasicLock* Lock); 97 98 // Special internal-use-only method for use by JVM infrastructure 99 // that needs to wait() on a java-level object but that can't risk 100 // throwing unexpected InterruptedExecutionExceptions. 101 static void waitUninterruptibly(Handle obj, jlong Millis, Thread * THREAD); 102 103 // used by classloading to free classloader object lock, | 48 typedef enum { 49 owner_self, 50 owner_none, 51 owner_other 52 } LockOwnership; 53 54 typedef enum { 55 inflate_cause_vm_internal = 0, 56 inflate_cause_monitor_enter = 1, 57 inflate_cause_wait = 2, 58 inflate_cause_notify = 3, 59 inflate_cause_hash_code = 4, 60 inflate_cause_jni_enter = 5, 61 inflate_cause_jni_exit = 6, 62 inflate_cause_nof = 7 // Number of causes 63 } InflateCause; 64 65 // exit must be implemented non-blocking, since the compiler cannot easily handle 66 // deoptimization at monitor exit. Hence, it does not take a Handle argument. 67 68 // This is full version of monitor enter and exit. 69 static void enter(Handle obj, BasicLock* lock, TRAPS); 70 static void exit(oop obj, BasicLock* lock, Thread* THREAD); 71 72 // Used only to handle jni locks or other unmatched monitor enter/exit 73 // Internally they will use heavy weight monitor. 74 static void jni_enter(Handle obj, TRAPS); 75 static void jni_exit(oop obj, Thread* THREAD); 76 77 // Handle all interpreter, compiler and jni cases 78 static int wait(Handle obj, jlong millis, TRAPS); 79 static void notify(Handle obj, TRAPS); 80 static void notifyall(Handle obj, TRAPS); 81 82 static bool quick_notify(oopDesc* obj, Thread* Self, bool All); 83 static bool quick_enter(oop obj, Thread* Self, BasicLock* Lock); 84 85 // Special internal-use-only method for use by JVM infrastructure 86 // that needs to wait() on a java-level object but that can't risk 87 // throwing unexpected InterruptedExecutionExceptions. 88 static void waitUninterruptibly(Handle obj, jlong Millis, Thread * THREAD); 89 90 // used by classloading to free classloader object lock, |