unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* USE_LSB_TAG and Solaris 10
       [not found]     ` <jwvbp3fql3p.fsf-monnier+emacs@gnu.org>
@ 2011-01-18  5:04       ` Paul Eggert
  2011-01-18 15:04         ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Eggert @ 2011-01-18  5:04 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier

Stefan suggested that I look into why USE_LSB_TAG wasn't used
with Sun cc, or on Solaris 10.

It turns out that Sun cc now supports __attribute__ ((__aligned__ (E)))
a la GCC.  Also, Solaris 10 malloc (which GCC uses) aligns to 8.
So I installed this performance improvement into the trunk.

=== modified file 'ChangeLog'
--- ChangeLog	2011-01-17 19:20:37 +0000
+++ ChangeLog	2011-01-18 04:54:43 +0000
@@ -1,3 +1,10 @@
+2011-01-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* configure.in (HAVE_ATTRIBUTE_ALIGNED): Arrange for this to be
+	defined if the compiler supports GCC-style __attribute__
+	((__aligned__ ...)).  IBM AIX and Oracle Solaris Studio support
+	this syntax.
+
 2011-01-17  Paul Eggert  <eggert@cs.ucla.edu>
 
 	Makefile.in: tidy up the building of lib

=== modified file 'configure.in'
--- configure.in	2011-01-17 19:01:01 +0000
+++ configure.in	2011-01-18 04:54:43 +0000
@@ -1323,6 +1323,19 @@
 dnl Check for endianess
 AC_C_BIGENDIAN
 
+AC_CACHE_CHECK([for  __attribute__ ((__aligned__ (expr)))],
+  [emacs_cv_attribute_aligned],
+  [AC_COMPILE_IFELSE(
+     [AC_LANG_PROGRAM(
+	[[char __attribute__ ((__aligned__ (1 << 3))) c;]],
+	[[]])],
+     [emacs_cv_attribute_aligned=yes],
+     [emacs_cv_attribute_aligned=no])])
+if test $emacs_cv_attribute_aligned = yes; then
+  AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1,
+    [Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works.])
+fi
+
 dnl check for Make feature
 AC_PROG_MAKE_SET
 
@@ -3734,4 +3747,3 @@
 fi
 
 ], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPPFLAGS="$CPPFLAGS"])
-

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2011-01-18 02:49:59 +0000
+++ src/ChangeLog	2011-01-18 04:54:43 +0000
@@ -1,3 +1,11 @@
+2011-01-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+	* lisp.h (DECL_ALIGN): Define if HAVE_ATTRIBUTE_ALIGNED, not if
+	defined __GNUC__.  ../configure now checks for this GCC feature,
+	which is now also supported by IBM and Oracle compilers.
+	(USE_LSB_TAG) [defined DECL_ALIGN]: Also define if defined __sun,
+	since Solaris malloc returns mult-of-8.
+
 2011-01-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* image.c (syms_of_image): Don't access XSYMBOL's internals directly.

=== modified file 'src/lisp.h'
--- src/lisp.h	2011-01-17 19:24:36 +0000
+++ src/lisp.h	2011-01-18 04:54:43 +0000
@@ -122,16 +122,18 @@
    TYPEBITS-aligned. */
 #ifndef NO_DECL_ALIGN
 # ifndef DECL_ALIGN
-/* What compiler directive should we use for non-gcc compilers?  -stef  */
-#  if defined (__GNUC__)
+#  if HAVE_ATTRIBUTE_ALIGNED
 #   define DECL_ALIGN(type, var) \
      type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
+#  else
+     /* What directives do other compilers use?  */
 #  endif
 # endif
 #endif
 
 /* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8.  */
-#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined DARWIN_OS
+#if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \
+     || defined DARWIN_OS || defined __sun)
 /* We also need to be able to specify mult-of-8 alignment on static vars.  */
 # if defined DECL_ALIGN
 #  define USE_LSB_TAG




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: USE_LSB_TAG and Solaris 10
  2011-01-18  5:04       ` USE_LSB_TAG and Solaris 10 Paul Eggert
@ 2011-01-18 15:04         ` Eli Zaretskii
  2011-01-18 18:25           ` Paul Eggert
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2011-01-18 15:04 UTC (permalink / raw)
  To: Paul Eggert; +Cc: monnier, emacs-devel

> Date: Mon, 17 Jan 2011 21:04:27 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>
> 
> It turns out that Sun cc now supports __attribute__ ((__aligned__ (E)))
> a la GCC.  Also, Solaris 10 malloc (which GCC uses) aligns to 8.
> So I installed this performance improvement into the trunk.
> 
> === modified file 'ChangeLog'
> --- ChangeLog	2011-01-17 19:20:37 +0000
> +++ ChangeLog	2011-01-18 04:54:43 +0000
> @@ -1,3 +1,10 @@
> +2011-01-18  Paul Eggert  <eggert@cs.ucla.edu>
> +
> +	* configure.in (HAVE_ATTRIBUTE_ALIGNED): Arrange for this to be
> +	defined if the compiler supports GCC-style __attribute__
> +	((__aligned__ ...)).  IBM AIX and Oracle Solaris Studio support
> +	this syntax.

And what do you think this change will do to platforms that don't run
the configure script, but do use GCC?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: USE_LSB_TAG and Solaris 10
  2011-01-18 15:04         ` Eli Zaretskii
@ 2011-01-18 18:25           ` Paul Eggert
  2011-01-18 22:55             ` Eli Zaretskii
  2011-01-19 14:48             ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Eggert @ 2011-01-18 18:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: monnier, emacs-devel

On 01/18/11 07:04, Eli Zaretskii wrote:
> And what do you think this change will do to platforms that don't run
> the configure script, but do use GCC?

These platforms should still work; they just won't use the
USE_LSB_TAG optimization.  At some point the maintainers
for these non-Posix platforms should arrange for their
configuration procedure to set HAVE_ATTRIBUTE_ALIGNED
if that is appropriate for optimization on their platforms.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: USE_LSB_TAG and Solaris 10
  2011-01-18 18:25           ` Paul Eggert
@ 2011-01-18 22:55             ` Eli Zaretskii
  2011-01-19 14:48             ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2011-01-18 22:55 UTC (permalink / raw)
  To: Paul Eggert; +Cc: monnier, emacs-devel

> Date: Tue, 18 Jan 2011 10:25:21 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: emacs-devel@gnu.org, monnier@iro.umontreal.ca
> 
> On 01/18/11 07:04, Eli Zaretskii wrote:
> > And what do you think this change will do to platforms that don't run
> > the configure script, but do use GCC?
> 
> These platforms should still work; they just won't use the
> USE_LSB_TAG optimization.  At some point the maintainers
> for these non-Posix platforms should arrange for their
> configuration procedure to set HAVE_ATTRIBUTE_ALIGNED
> if that is appropriate for optimization on their platforms.

Avoiding that needs a simple change in exactly 2 files: nt/config.nt
for the Windows build and msdos/sed2v2.inp for the MS-DOS build.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: USE_LSB_TAG and Solaris 10
  2011-01-18 18:25           ` Paul Eggert
  2011-01-18 22:55             ` Eli Zaretskii
@ 2011-01-19 14:48             ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-01-19 14:48 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Eli Zaretskii, emacs-devel

> they just won't use the USE_LSB_TAG optimization.

Just a clarification: USE_LSB_TAG is not an really optimization, or at
least I don't think anyone has tried to measure its performance.  It is
meant to let Emacs use all the available virtual memory rather than be
limited to 128MB (IIRC) of memory on 32bit systems (not to be confused
with the limit on maximum buffer size, which is determined by the
largest fixnum, i.e. 512MB on 32bit systems on the trunk).


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-19 14:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1PekHk-0001J5-48@internal.in.savannah.gnu.org>
     [not found] ` <jwvsjwrqqpz.fsf-monnier+emacs@gnu.org>
     [not found]   ` <4D34A57E.4080809@cs.ucla.edu>
     [not found]     ` <jwvbp3fql3p.fsf-monnier+emacs@gnu.org>
2011-01-18  5:04       ` USE_LSB_TAG and Solaris 10 Paul Eggert
2011-01-18 15:04         ` Eli Zaretskii
2011-01-18 18:25           ` Paul Eggert
2011-01-18 22:55             ` Eli Zaretskii
2011-01-19 14:48             ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).