diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2014-09-09 23:38:38 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2014-09-09 23:38:38 -0700 |
commit | 11e28ab08d44c1fc40e3e4dc728c14c521b3879d (patch) | |
tree | fd5f541d44d9d3d6383f2064c9e45c684b73d6cf /configure.ac | |
parent | c98d0ea46197545b899b463c1ba9ff2fea8e8c6e (diff) | |
download | emacs-11e28ab08d44c1fc40e3e4dc728c14c521b3879d.tar.gz |
Improve the experimental local and scoped allocation.
* configure.ac (HAVE_STRUCT_ATTRIBUTE_ALIGNED)
(HAVE_STATEMENT_EXPRESSIONS): New configure-time checks.
* src/alloc.c (local_string_init, local_vector_init):
New functions, defined if USE_LOCAL_ALLOCATORS.
Mostly, these are moved here from lisp.h, as it's not
clear it's worth making them inline.
* src/lisp.h (USE_STACK_LISP_OBJECTS): Default to false.
(GCALIGNED): Depend on HAVE_STRUCT_ATTRIBUTE_ALIGNED and
USE_STACK_LISP_OBJECTS, not on a laundry list.
(local_string_init, local_vector_init): New decls.
(union Aligned_Cons): New type.
(scoped_cons): Use it. Give up on the char trick, as it's a too
much of a maintenance hassle; if someone wants this speedup
they'll just need to convince their compiler to align properly.
Conversely, use the speedup if struct Lisp_Cons happens to
be aligned even without a directive. Better yet, help it along
by using union Aligned_Cons rather than struct Lisp_Cons.
(pointer_valid_for_lisp_object): Remove. This check is not
necessary, since make_lisp_ptr is already doing it. All uses removed.
(local_vector_init, local_string_init): Move to alloc.c.
(build_local_vector): Remove this awkward macro, replacing with ...
(make_local_vector): New macro, which acts more like a function.
Use statement expressions and use __COUNTER__ to avoid macro
capture. Fall back on functions if these features are not supported.
(build_local_string, make_local_string): Likewise.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 6bfa8cc4ad2..93487246f29 100644 --- a/configure.ac +++ b/configure.ac @@ -4822,6 +4822,33 @@ else fi AC_SUBST(LIBXMENU) +AC_CACHE_CHECK([for struct alignment], + [emacs_cv_struct_alignment], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <stddef.h> + struct __attribute__ ((aligned (8))) s { char c; }; + struct t { char c; struct s s; }; + char verify[offsetof (struct t, s) == 8 ? 1 : -1]; + ]])], + [emacs_cv_struct_alignment=yes], + [emacs_cv_struct_alignment=no])]) +if test "$emacs_cv_struct_alignment" = yes; then + AC_DEFINE([HAVE_STRUCT_ATTRIBUTE_ALIGNED], 1, + [Define to 1 if 'struct __attribute__ ((aligned (N)))' aligns the + structure to an N-byte boundary.]) +fi + +AC_CACHE_CHECK([for statement expressions], + [emacs_cv_statement_expressions], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], [[return ({ int x = 5; x-x; });]])], + [emacs_cv_statement_expressions=yes], + [emacs_cv_statement_expressions=no])]) +if test "$emacs_cv_statement_expressions" = yes; then + AC_DEFINE([HAVE_STATEMENT_EXPRESSIONS], 1, + [Define to 1 if statement expressions work.]) +fi + if test "${GNU_MALLOC}" = "yes" ; then AC_DEFINE(GNU_MALLOC, 1, [Define to 1 if you want to use the GNU memory allocator.]) |