diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-06-07 15:41:51 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-06-07 15:44:15 -0700 |
commit | 302185156b6c20df5400a9956c09d6c24d29f652 (patch) | |
tree | 7d8e87dd55aaec9df6775bb0cc903cfba72cfed9 /src/conf_post.h | |
parent | 8ea5d990f6315917bbd9c7b94856c52137405dad (diff) | |
download | emacs-302185156b6c20df5400a9956c09d6c24d29f652.tar.gz emacs-302185156b6c20df5400a9956c09d6c24d29f652.tar.bz2 emacs-302185156b6c20df5400a9956c09d6c24d29f652.zip |
Use __builtin_assume_aligned on untagged Lisp vals
* src/conf_post.h (__has_builtin, __builtin_assume_aligned):
New macros, for compilers not already defining them.
(__has_builtin___builtin_assume_aligned): New macro.
* src/lisp.h (lisp_h_XUNTAG): Use __builtin_assume_aligned.
This shrinks text space by 0.2% on x86-64 with GCC 6.1.
Diffstat (limited to 'src/conf_post.h')
-rw-r--r-- | src/conf_post.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/conf_post.h b/src/conf_post.h index bea2a8a587f..762aa7727fd 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -64,6 +64,15 @@ typedef bool bool_bf; (4 < __GNUC__ + (8 <= __GNUC_MINOR__)) #endif +/* Simulate __has_builtin on compilers that lack it. It is used only + on arguments like __builtin_assume_aligned that are handled in this + simulation. */ +#ifndef __has_builtin +# define __has_builtin(a) __has_builtin_##a +# define __has_builtin___builtin_assume_aligned \ + (4 < __GNUC__ + (7 <= __GNUC_MINOR__)) +#endif + /* Simulate __has_feature on compilers that lack it. It is used only to define ADDRESS_SANITIZER below. */ #ifndef __has_feature @@ -77,6 +86,11 @@ typedef bool bool_bf; # define ADDRESS_SANITIZER false #endif +/* Yield PTR, which must be aligned to ALIGNMENT. */ +#if ! __has_builtin (__builtin_assume_aligned) +# define __builtin_assume_aligned(ptr, alignment, ...) ((void *) (ptr)) +#endif + #ifdef DARWIN_OS #ifdef emacs #define malloc unexec_malloc |