[PATCH?] Separate pthread patches, #2 take 3

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Thu Jun 4 01:42:00 GMT 2009


On Thu, Jun 04, 2009 at 12:47:48AM +0100, Dave Korn wrote:
>Dave Korn wrote:
>>   The attached patch implements ilockexch and ilockcmpexch, using the inline
>> asm definition from __arch_compare_and_exchange_val_32_acq in
>> glibc-2.10.1/sysdeps/i386/i486/bits/atomic.h, trivially expanded inline rather
>> than in its original preprocessor macro form.
>
>  The attached patch does likewise, but adds a "memory" clobber.  It generates
>correct code:
>
>L186:
>	.loc 3 127 0
>	movl	__ZN13pthread_mutex7mutexesE+8, %eax	 # mutexes.head, D.28599
>	movl	%eax, 36(%ebx)	 # D.28599, <variable>.next
>	.loc 2 60 0
>/APP
> # 60 "/gnu/winsup/src/winsup/cygwin/winbase.h" 1
>	lock cmpxchgl %ebx, __ZN13pthread_mutex7mutexesE+8	 # this,
> # 0 "" 2
>/NO_APP
>	movl	%eax, -12(%ebp)	 # tmp68, ret
>	.loc 2 61 0
>	movl	-12(%ebp), %eax	 # ret, D.28596
>	.loc 3 126 0
>	cmpl	%eax, 36(%ebx)	 # D.28596, <variable>.next
>	jne	L186	 #,
>
>
>although as you see it has some needless register motion as it stores %eax to
>the stack slot for ret and reloads it.  Still, this is now almost as good as
>the code generated by my original patch.
>
>winsup/cygwin/ChangeLog
>
>	* winbase.h (ilockexch):  Fix asm constraints.
>	(ilockcmpexch):  Likewise.
>
>
>  Ok-ish?

I thought that, given your last message to cygwin-developers, you were
going to go off and figure out the best of four implementations.  Is this
the result of that investigation?

cgf



More information about the Cygwin-patches mailing list