summaryrefslogtreecommitdiffstats
path: root/runtime/arch/x86/quick_entrypoints_x86.S
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2013-10-29 19:21:51 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-29 19:21:51 +0000
commitfea1024bb9d35a1e61ebfbf2b76f565029547990 (patch)
tree729cf275e31d05090debd42bcacf4e7d09a0a042 /runtime/arch/x86/quick_entrypoints_x86.S
parentbcf762094b0d7a6cfd40ecb40a08852ac11c0536 (diff)
parentad2541a59c00c2c69e8973088891a2b5257c9780 (diff)
downloadart-fea1024bb9d35a1e61ebfbf2b76f565029547990.zip
art-fea1024bb9d35a1e61ebfbf2b76f565029547990.tar.gz
art-fea1024bb9d35a1e61ebfbf2b76f565029547990.tar.bz2
Merge "Fix object identity hash." into dalvik-dev
Diffstat (limited to 'runtime/arch/x86/quick_entrypoints_x86.S')
-rw-r--r--runtime/arch/x86/quick_entrypoints_x86.S6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/arch/x86/quick_entrypoints_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S
index 805f6f4..4e79770 100644
--- a/runtime/arch/x86/quick_entrypoints_x86.S
+++ b/runtime/arch/x86/quick_entrypoints_x86.S
@@ -411,9 +411,10 @@ DEFINE_FUNCTION art_quick_lock_object
jz slow_lock
retry_lock:
movl LOCK_WORD_OFFSET(%eax), %ecx // ecx := lock word
+ test LITERAL(0xC0000000), %ecx // test the 2 high bits.
+ jne slow_lock // slow path if either of the two high bits are set.
movl %fs:THREAD_ID_OFFSET, %edx // edx := thread id
test %ecx, %ecx
- jb slow_lock // lock word contains a monitor
jnz already_thin // lock word contains a thin lock
// unlocked case - %edx holds thread id with count of 0
movl %eax, %ecx // remember object in case of retry
@@ -428,7 +429,8 @@ already_thin:
cmpw %ax, %dx // do we hold the lock already?
jne slow_lock
addl LITERAL(65536), %eax // increment recursion count
- jb slow_lock // count overflowed so go slow
+ test LITERAL(0xC0000000), %eax // overflowed if either of top two bits are set
+ jne slow_lock // count overflowed so go slow
movl %eax, LOCK_WORD_OFFSET(%ecx) // update lockword, cmpxchg not necessary as we hold lock
ret
slow_lock: