Closed Bug 654873 Opened 14 years ago Closed 14 years ago

ARM target (gcc 4.5.2 or later) should use built-in atomic function instead of arm-kuser

Categories

(Core :: JavaScript Engine, defect)

ARM
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: m_kato, Assigned: m_kato)

Details

(Whiteboard: [fixed-in-tracemonkey])

Attachments

(1 file)

Now, jslock uses arm-kuser that is the atomic functions into Linux kernel. But gcc 4.5.2 or later has __sync_bool_compare_and_swap(). We should use it. current code, 00000000 <_Z17js_CompareAndSwapPViii>: 0: b5f8 push {r3, r4, r5, r6, r7, lr} 2: f44f 667c mov.w r6, #4032 ; 0xfc0 6: 4605 mov r5, r0 8: 460c mov r4, r1 a: 4617 mov r7, r2 c: f6cf 76ff movt r6, #65535 ; 0xffff 10: 4620 mov r0, r4 12: 4639 mov r1, r7 14: 462a mov r2, r5 16: 47b0 blx r6 <---- Call kernel code 18: b950 cbnz r0, 30 <_Z17js_CompareAndSwapPViii+0x30> 1a: f1d0 0001 rsbs r0, r0, #1 1e: bf38 it cc 20: 2000 movcc r0, #0 22: bdf8 pop {r3, r4, r5, r6, r7, pc} 24: f3af 8000 nop.w 28: f3af 8000 nop.w 2c: f3af 8000 nop.w 30: 682b ldr r3, [r5, #0] 32: 429c cmp r4, r3 34: d0ec beq.n 10 <_Z17js_CompareAndSwapPViii+0x10> 36: f1d0 0001 rsbs r0, r0, #1 3a: bf38 it cc 3c: 2000 movcc r0, #0 3e: bdf8 pop {r3, r4, r5, r6, r7, pc} after (using __sync_bool_compare_and_swap) 00000000 <_Z17js_CompareAndSwapPViii>: 0: f3bf 8f5f dmb sy 4: e850 3f00 ldrex r3, [r0] 8: 428b cmp r3, r1 a: d107 bne.n 1c <_Z17js_CompareAndSwapPViii+0x1c> c: e840 2300 strex r3, r2, [r0] 10: f093 0f00 teq r3, #0 14: d1f6 bne.n 4 <_Z17js_CompareAndSwapPViii+0x4> 16: 460b mov r3, r1 18: f3bf 8f5f dmb sy 1c: 1a5b subs r3, r3, r1 1e: 4258 negs r0, r3 20: eb40 0003 adc.w r0, r0, r3 24: 4770 bx lr 26: bf00 nop 28: f3af 8000 nop.w 2c: f3af 8000 nop.w
Hardware: x86_64 → ARM
Nice.
Attached patch fixSplinter Review
Assignee: general → m_kato
Status: NEW → ASSIGNED
Attachment #530557 - Flags: review?(gal)
Comment on attachment 530557 [details] [diff] [review] fix Cool. Thanks. I assume this is guaranteed to work with all ARM architectures we support?
Attachment #530557 - Flags: review?(gal) → review+
(In reply to comment #3) > Comment on attachment 530557 [details] [diff] [review] [review] > fix > > Cool. Thanks. I assume this is guaranteed to work with all ARM architectures > we support? Our target platform is ARMv7 architecture (Android, Maemo and MeeGo). __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 is only defined when -march or -mcpu is such as ARMv7 that has barrier instructions (dmb and strex). So if using -march=armv4t (ARMv4 Thumb), __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 isn't defined.
Whiteboard: [fixed-in-tracemonkey]
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: