This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Mirror i386 change on sparc: 'Avoid "anonymous" code in pthread_spin_lock'


On Wed, May 2, 2012 at 7:46 PM, Chris Metcalf <cmetcalf@tilera.com> wrote:

> Wouldn't you get the same result as the assembly code just by removing the
> .subsection and .previous directives? ?In that case the code would all be
> under the C function label, which is the point of the change.

FWIW, I tried that approach with i386,x86_64 code.

The result with .subsection removed was:

  0:   f0 ff 0f                lock decl (%rdi)
  3:   75 0b                   jne    10 <pthread_spin_lock+0x10>

 10:   f3 90                   pause
 12:   83 3f 00                cmpl   $0x0,(%rdi)
 15:   7f e9                   jg     0 <pthread_spin_lock>
 17:   eb f7                   jmp    10 <pthread_spin_lock+0x10>
 19:   31 c0                   xor    %eax,%eax
 1b:   c3                      retq

If I am reading this correctly, this will spin forever.

-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]