public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Will Hawkins <whh8b@virginia.edu>, libc-help@sourceware.org
Subject: Re: Question about the highly optimized aspects of libc implementation
Date: Thu, 30 Nov 2017 08:36:00 -0000	[thread overview]
Message-ID: <fde62ca9-cc75-d065-3ab3-25b627e0f12d@redhat.com> (raw)
In-Reply-To: <CAE+MWFsT5vu4yW0zDKgyinZky=2s-i2wzK7N-fnKuQP0kGQ_Bw@mail.gmail.com>

On 11/30/2017 07:47 AM, Will Hawkins wrote:
> I've been digging through the glibc implementation and looking for
> examples of where compiler directives or hand-written assembly have
> been used to improve performance at the "expense" of standards or
> conventions.

The fcntl implementation calls va_arg on a variadic argument which might 
not actually exist.  The syscall function does something similar (but it 
is actually implemented in machine code, so it's less of a problem).

The NSS internals in general and getaddrinfo in particular call 
functions through a mis-matching function pointer (with an additional 
argument added, or with a void * argument where the function is defined 
with a concrete function pointer).

Calling functions such as getpwuid_r with a pointer which has not been 
allocated on the heap (or reusing an existing allocation for a second 
call) is probably not quite valid C due to aliasing violations.

A lot of the code which manipulates struct 
sockaddr/sockaddr_in/sockaddr_in6 objects does not make the additional 
copies which are needed to avoid aliasing violations.

Do you need more?  I can probably go on for quite some time.

Thanks,
Florian

  parent reply	other threads:[~2017-11-30  8:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30  6:48 Will Hawkins
2017-11-30  6:54 ` Siddhesh Poyarekar
2017-11-30  8:22   ` Florian Weimer
2017-11-30  6:56 ` Carlos O'Donell
2017-11-30  7:00   ` Will Hawkins
2017-11-30  8:36 ` Florian Weimer [this message]
2017-12-04  1:15   ` Will Hawkins
2017-12-04  8:12     ` Siddhesh Poyarekar
2017-12-04 12:15     ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fde62ca9-cc75-d065-3ab3-25b627e0f12d@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-help@sourceware.org \
    --cc=whh8b@virginia.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).