bionic/libc/string
Christopher Ferris 7c860db074 Optimize __memset_chk, __memcpy_chk.
This change creates assembler versions of __memcpy_chk/__memset_chk
that is implemented in the memcpy/memset assembler code. This change
avoids an extra call to memcpy/memset, instead allowing a simple fall
through to occur from the chk code into the body of the real
implementation.

Testing:

- Ran the libc_test on __memcpy_chk/__memset_chk on all nexus devices.
- Wrote a small test executable that has three calls to __memcpy_chk and
  three calls to __memset_chk. First call dest_len is length + 1. Second
  call dest_len is length. Third call dest_len is length - 1.
  Verified that the first two calls pass, and the third fails. Examined
  the logcat output on all nexus devices to verify that the fortify
  error message was sent properly.
- I benchmarked the new __memcpy_chk and __memset_chk on all systems. For
  __memcpy_chk and large copies, the savings is relatively small (about 1%).
  For small copies, the savings is large on cortex-a15/krait devices
  (between 5% to 30%).
  For cortex-a9 and small copies, the speed up is present, but relatively
  small (about 3% to 5%).
  For __memset_chk and large copies, the savings is also small (about 1%).
  However, all processors show larger speed-ups on small copies (about 30% to
  100%).

Bug: 9293744

Change-Id: I8926d59fe2673e36e8a27629e02a7b7059ebbc98
2013-08-06 15:38:29 -07:00
..
bcopy.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
index.c string: Fix wrong comparison semantics 2011-12-05 18:37:10 -08:00
memcmp16.c Add ssse3 implementation of __memcmp16. 2013-08-02 17:57:23 -07:00
strcasecmp.c improve readability of string: fix indentation and remove trailing spaces 2010-01-30 22:28:49 -02:00
strcat.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
strcmp.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
strcpy.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
strcspn.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
strdup.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
strlcat.c improve readability of string: fix indentation and remove trailing spaces 2010-01-30 22:28:49 -02:00
strlcpy.c improve readability of string: fix indentation and remove trailing spaces 2010-01-30 22:28:49 -02:00
strlen.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
strncat.c improve readability of string: fix indentation and remove trailing spaces 2010-01-30 22:28:49 -02:00
strncmp.c improve readability of string: fix indentation and remove trailing spaces 2010-01-30 22:28:49 -02:00
strncpy.c improve readability of string: fix indentation and remove trailing spaces 2010-01-30 22:28:49 -02:00
strpbrk.c improve readability of string: fix indentation and remove trailing spaces 2010-01-30 22:28:49 -02:00
strrchr.c bionic/x86: Optimization for string routines 2013-05-31 13:37:03 +04:00
strsep.c improve readability of string: fix indentation and remove trailing spaces 2010-01-30 22:28:49 -02:00
strspn.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00
strstr.c improve readability of string: fix indentation and remove trailing spaces 2010-01-30 22:28:49 -02:00
strtok.c auto import from //depot/cupcake/@135843 2009-03-03 19:28:35 -08:00