diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2015-02-09 17:11:42 -0800 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2015-03-03 17:33:18 -0800 |
commit | e15ea086439b41a805d164d2beb07b4ba96aaa97 (patch) | |
tree | 465ee3780acd8b7cb35c8a7f42a1f3c5df3d26ec /runtime/monitor_pool.h | |
parent | 0b25c71ac93fb10c484dbacb9e23db505a8e2353 (diff) | |
download | android_art-e15ea086439b41a805d164d2beb07b4ba96aaa97.tar.gz android_art-e15ea086439b41a805d164d2beb07b4ba96aaa97.tar.bz2 android_art-e15ea086439b41a805d164d2beb07b4ba96aaa97.zip |
Reserve bits in the lock word for read barriers.
This prepares for the CC collector to use the standard object header
model by storing the read barrier state in the lock word.
Bug: 19355854
Bug: 12687968
Change-Id: Ia7585662dd2cebf0479a3e74f734afe5059fb70f
Diffstat (limited to 'runtime/monitor_pool.h')
-rw-r--r-- | runtime/monitor_pool.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/runtime/monitor_pool.h b/runtime/monitor_pool.h index 27678dcbdd..8ae5a54fe7 100644 --- a/runtime/monitor_pool.h +++ b/runtime/monitor_pool.h @@ -45,7 +45,9 @@ class MonitorPool { static Monitor* CreateMonitor(Thread* self, Thread* owner, mirror::Object* obj, int32_t hash_code) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { #ifndef __LP64__ - return new Monitor(self, owner, obj, hash_code); + Monitor* mon = new Monitor(self, owner, obj, hash_code); + DCHECK_ALIGNED(mon, LockWord::kMonitorIdAlignment); + return mon; #else return GetMonitorPool()->CreateMonitorInPool(self, owner, obj, hash_code); #endif @@ -71,7 +73,7 @@ class MonitorPool { static Monitor* MonitorFromMonitorId(MonitorId mon_id) { #ifndef __LP64__ - return reinterpret_cast<Monitor*>(mon_id << 3); + return reinterpret_cast<Monitor*>(mon_id << LockWord::kMonitorIdAlignmentShift); #else return GetMonitorPool()->LookupMonitor(mon_id); #endif @@ -79,7 +81,7 @@ class MonitorPool { static MonitorId MonitorIdFromMonitor(Monitor* mon) { #ifndef __LP64__ - return reinterpret_cast<MonitorId>(mon) >> 3; + return reinterpret_cast<MonitorId>(mon) >> LockWord::kMonitorIdAlignmentShift; #else return mon->GetMonitorId(); #endif |