This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Mirror i386 change on sparc: 'Avoid "anonymous" codein pthread_spin_lock'
On 5/3/2012 10:57 AM, Paul Pluzhnikov wrote:
> On Thu, May 3, 2012 at 7:51 AM, Andreas Schwab <firstname.lastname@example.org> wrote:
>> The point of the subsection is so that you don't need the jump around.
>> It's simulating the compiler putting an unlikely BB out of line.
> I understand that. My point is that "just by removing the .subsection"
> doesn't produce working code.
Sorry, I was using shorthand to suggest my point about section-changing
versus anonymity. As you observe, to actually make it work properly, you
need to avoid the fallthrough into the unlikely part of the code.
Whether this is actually doable or not without an explicit branch-around
depends on the architecture. I'm not familiar enough with sparc calling
conventions or sparc gcc to be confident that you could just guarantee that
the compiler won't create a frame, and thus put an inline "ret" directly in
the "likely" path. With tile gcc and calling conventions, you could just
have an "#ifndef __OPTIMIZE__/#error", and then you'd know that the
function would be created without a frame and you could therefore return
out of the middle of the assembly.
All that said, it's still cleaner to put functions that just contain a big
asm() in a .S file instead, in any case, even if you're confident about the
compiler frame setup issues.
Chris Metcalf, Tilera Corp.