summaryrefslogtreecommitdiffstats
path: root/vm/Sync.h
diff options
context:
space:
mode:
authorCarl Shapiro <cshapiro@google.com>2009-12-21 20:23:45 -0800
committerCarl Shapiro <cshapiro@google.com>2009-12-22 18:02:49 -0800
commit8d7f9b2cd9fe252399ae96a36781bba1242fb93c (patch)
tree64f40673a43c25eed3d08257d99e3f9c3757a70f /vm/Sync.h
parent4ef41b2ccbc3536f4d147e4fe3c6bc4d1f85bdbd (diff)
downloadandroid_dalvik-8d7f9b2cd9fe252399ae96a36781bba1242fb93c.tar.gz
android_dalvik-8d7f9b2cd9fe252399ae96a36781bba1242fb93c.tar.bz2
android_dalvik-8d7f9b2cd9fe252399ae96a36781bba1242fb93c.zip
Supersede the Lock union type with a word-sized integer in the object
instance header. An object's lock member is now just a bit-field.
Diffstat (limited to 'vm/Sync.h')
-rw-r--r--vm/Sync.h18
1 files changed, 3 insertions, 15 deletions
diff --git a/vm/Sync.h b/vm/Sync.h
index c3785b3c1..7f5ef08c2 100644
--- a/vm/Sync.h
+++ b/vm/Sync.h
@@ -50,30 +50,18 @@ typedef struct Monitor Monitor;
#define QUIET_ZYGOTE_MONITOR 1
/*
- * Synchronization lock, included in every object.
- *
- * We want this to be a 32-bit "thin lock", holding the lock level and
- * the owner's threadId, that inflates to a Monitor pointer when there
- * is contention or somebody waits on it.
- */
-typedef union Lock {
- u4 thin;
- Monitor* mon;
-} Lock;
-
-/*
* Initialize a Lock to the proper starting value.
* This is necessary for thin locking.
*/
#define DVM_LOCK_INITIAL_THIN_VALUE (0)
#define DVM_LOCK_INIT(lock) \
- do { (lock)->thin = DVM_LOCK_INITIAL_THIN_VALUE; } while (0)
+ do { *(lock) = DVM_LOCK_INITIAL_THIN_VALUE; } while (0)
/*
* Returns true if the lock has been fattened.
*/
-#define IS_LOCK_FAT(lock) (LW_SHAPE((lock)->thin) == LW_SHAPE_FAT)
+#define IS_LOCK_FAT(lock) (LW_SHAPE(*(lock)) == LW_SHAPE_FAT)
/*
* Acquire the object's monitor.
@@ -114,7 +102,7 @@ void dvmThreadInterrupt(volatile struct Thread* thread);
Monitor* dvmCreateMonitor(struct Object* obj);
/* free an object's monitor during GC */
-void dvmFreeObjectMonitor_internal(Lock* lock);
+void dvmFreeObjectMonitor_internal(u4 *lock);
#define dvmFreeObjectMonitor(obj) \
do { \
Object *DFM_obj_ = (obj); \