svn commit: r333265 - head/sys/sys

Mateusz Guzik mjg at FreeBSD.org
Fri May 4 22:33:55 UTC 2018


Author: mjg
Date: Fri May  4 22:33:54 2018
New Revision: 333265
URL: https://svnweb.freebsd.org/changeset/base/333265

Log:
  Allow the compiler to use __builtin_memcpy
  
  In particular this allows the compiler to avoid heavy-handed machinery
  if the to be copied buffer is small.
  
  Reviewed by:	jhb

Modified:
  head/sys/sys/systm.h
  head/sys/sys/zutil.h

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Fri May  4 21:17:29 2018	(r333264)
+++ head/sys/sys/systm.h	Fri May  4 22:33:54 2018	(r333265)
@@ -275,6 +275,7 @@ void	bzero(void * _Nonnull buf, size_t len);
 void	explicit_bzero(void * _Nonnull, size_t);
 
 void	*memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len);
+#define memcpy(to, from, len) __builtin_memcpy(to, from, len)
 void	*memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n);
 
 int	copystr(const void * _Nonnull __restrict kfaddr,

Modified: head/sys/sys/zutil.h
==============================================================================
--- head/sys/sys/zutil.h	Fri May  4 21:17:29 2018	(r333264)
+++ head/sys/sys/zutil.h	Fri May  4 22:33:54 2018	(r333265)
@@ -32,7 +32,6 @@
 #include <sys/param.h>
 #include <sys/kernel.h>
 #  define HAVE_MEMCPY
-#  define memcpy(d, s, n)	bcopy((s), (d), (n))
 #  define memset(d, v, n)	bzero((d), (n))
 #  define memcmp		bcmp
 


More information about the svn-src-all mailing list