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: [RFC] pthread_once: Use unified variant instead of custom x86_64/i386


On 04/07/2014 06:47 AM, Torvald Riegel wrote:
>> 00000000000000e0 <__pthread_once>:
>>   e0:   8b 07                   mov    (%rdi),%eax
>>   e2:   a8 02                   test   $0x2,%al
>>   e4:   74 03                   je     e9 <__pthread_once+0x9>
>>   e6:   31 c0                   xor    %eax,%eax
>>   e8:   c3                      retq   
>>   e9:   31 c0                   xor    %eax,%eax
>>   eb:   e9 30 ff ff ff          jmpq   20 <__pthread_once_slow>

...

>     interrupted cases anymore.  */
> -int
> -__pthread_once (once_control, init_routine)
> +static int
> +__attribute__((noinline))
> +__pthread_once_slow (once_control, init_routine)
>       pthread_once_t *once_control;
>       void (*init_routine) (void);

As long as you're changing this, you might as well convert to ISO C prototype
form.  That will eliminate the xor at 0xe9 above, which is only required for
the x86_64 variadic ABI, which is the fallback for functions without prototypes.



r~


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