diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-10-29 19:21:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-29 19:21:51 +0000 |
commit | fea1024bb9d35a1e61ebfbf2b76f565029547990 (patch) | |
tree | 729cf275e31d05090debd42bcacf4e7d09a0a042 /runtime/arch/arm | |
parent | bcf762094b0d7a6cfd40ecb40a08852ac11c0536 (diff) | |
parent | ad2541a59c00c2c69e8973088891a2b5257c9780 (diff) | |
download | art-fea1024bb9d35a1e61ebfbf2b76f565029547990.zip art-fea1024bb9d35a1e61ebfbf2b76f565029547990.tar.gz art-fea1024bb9d35a1e61ebfbf2b76f565029547990.tar.bz2 |
Merge "Fix object identity hash." into dalvik-dev
Diffstat (limited to 'runtime/arch/arm')
-rw-r--r-- | runtime/arch/arm/quick_entrypoints_arm.S | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S index 736ce2f..c11349802 100644 --- a/runtime/arch/arm/quick_entrypoints_arm.S +++ b/runtime/arch/arm/quick_entrypoints_arm.S @@ -325,24 +325,25 @@ END art_quick_handle_fill_data ENTRY art_quick_lock_object cbz r0, slow_lock retry_lock: - ldrex r1, [r0, #LOCK_WORD_OFFSET] ldrt r2, [r9, #THREAD_ID_OFFSET] - cmp r1, #0 - bmi slow_lock @ lock word contains a monitor - bne already_thin + ldrex r1, [r0, #LOCK_WORD_OFFSET] + cbnz r1, not_unlocked @ already thin locked @ unlocked case - r2 holds thread id with count of 0 strex r3, r2, [r0, #LOCK_WORD_OFFSET] cbnz r3, strex_fail @ store failed, retry bx lr strex_fail: b retry_lock @ unlikely forward branch, need to reload and recheck r1/r2 -already_thin: +not_unlocked: + lsr r3, r1, 30 + cbnz r3, slow_lock @ if either of the top two bits are set, go slow path eor r2, r1, r2 @ lock_word.ThreadId() ^ self->ThreadId() uxth r2, r2 @ zero top 16 bits cbnz r2, slow_lock @ lock word and self thread id's match -> recursive lock @ else contention, go to slow path - adds r2, r1, #65536 @ increment count in lock word placing in r2 for storing - bmi slow_lock @ if we overflow the count go slow + add r2, r1, #65536 @ increment count in lock word placing in r2 for storing + lsr r1, r2, 30 @ if either of the top two bits are set, we overflowed. + cbnz r1, slow_lock @ if we overflow the count go slow path str r2, [r0, #LOCK_WORD_OFFSET] @ no need for strex as we hold the lock bx lr slow_lock: @@ -363,9 +364,9 @@ END art_quick_lock_object ENTRY art_quick_unlock_object cbz r0, slow_unlock ldr r1, [r0, #LOCK_WORD_OFFSET] + lsr r2, r1, 30 + cbnz r2, slow_unlock @ if either of the top two bits are set, go slow path ldr r2, [r9, #THREAD_ID_OFFSET] - cmp r1, #0 - bmi slow_unlock @ lock word contains a monitor eor r3, r1, r2 @ lock_word.ThreadId() ^ self->ThreadId() uxth r3, r3 @ zero top 16 bits cbnz r3, slow_unlock @ do lock word and self thread id's match? |