This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] pthread_once: Use unified variant instead of custom x86_64/i386
- From: Richard Henderson <rth at twiddle dot net>
- To: Torvald Riegel <triegel at redhat dot com>, GLIBC Devel <libc-alpha at sourceware dot org>
- Cc: andi <andi at firstfloor dot org>
- Date: Mon, 07 Apr 2014 08:47:55 -0700
- Subject: Re: [RFC] pthread_once: Use unified variant instead of custom x86_64/i386
- Authentication-results: sourceware.org; auth=none
- References: <1381523328 dot 18547 dot 3422 dot camel at triegel dot csb> <1396878469 dot 10643 dot 8959 dot camel at triegel dot csb>
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~