unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>, martin rudalics <rudalics@gmx.at>
Cc: rgm@gnu.org, emacs-devel@gnu.org
Subject: Re: emacs-26 9e59de9: Use GCALIGNED properly for GCC
Date: Fri, 10 Nov 2017 23:57:13 -0800	[thread overview]
Message-ID: <311e52a3-67a2-375b-18e4-1a6a60f04ecb@cs.ucla.edu> (raw)
In-Reply-To: <899d6f0d-78d2-a954-1c97-c0088cdd6337@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 296 bytes --]

Paul Eggert wrote:
> It shrinks the source code a bit, which is a 
> good sign.

There's one more place we can simplify the code because Emacs no longer uses 
__attribute__ ((aligned (8))). Further patch attached. As a bonus this 
eliminates the slightly-ridiculous Fcons loop in emacs-module.c.

[-- Attachment #2: 0001-Simplify-by-removing-HAVE_STRUCT_ATTRIBUTE_ALIGNED.patch --]
[-- Type: text/x-patch, Size: 3047 bytes --]

From 5ad538acf5cc34f26420780fa642bce02a88d0ee Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 10 Nov 2017 23:52:29 -0800
Subject: [PATCH] Simplify by removing HAVE_STRUCT_ATTRIBUTE_ALIGNED

* configure.ac (HAVE_STRUCT_ATTRIBUTE_ALIGNED): Remove.  No longer
needed, since we no longer rely on __attribute__ ((aligned (8))).
All uses removed.
* src/emacs-module.c (HAVE_STRUCT_ATTRIBUTE_ALIGNED): Remove.
(lisp_to_value): Simplify now that we no longer need to worry
whether HAVE_STRUCT_ATTRIBUTE_ALIGNED is false.
---
 admin/CPP-DEFINES  |  1 -
 configure.ac       | 16 ----------------
 src/emacs-module.c | 17 -----------------
 3 files changed, 34 deletions(-)

diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index 10b558d1ad..7a90b3dbe4 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -103,7 +103,6 @@ HAVE_ALARM
 HAVE_ALLOCA
 HAVE_ALLOCA_H
 HAVE_ALSA
-HAVE_ATTRIBUTE_ALIGNED
 HAVE_BDFFONT
 HAVE_BOXES
 HAVE_C99_STRTOLD
diff --git a/configure.ac b/configure.ac
index 5579342c4e..3c72f168a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5113,22 +5113,6 @@ AC_DEFUN
 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
-
 if test "${GNU_MALLOC}" = "yes" ; then
   AC_DEFINE(GNU_MALLOC, 1,
 	    [Define to 1 if you want to use the GNU memory allocator.])
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 6bc91a7e06..b351515c3b 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -998,10 +998,6 @@ lisp_to_value_bits (Lisp_Object o)
   return (emacs_value) p;
 }
 
-#ifndef HAVE_STRUCT_ATTRIBUTE_ALIGNED
-enum { HAVE_STRUCT_ATTRIBUTE_ALIGNED = 0 };
-#endif
-
 /* Convert O to an emacs_value.  Allocate storage if needed; this can
    signal if memory is exhausted.  Must be an injective function.  */
 static emacs_value
@@ -1029,19 +1025,6 @@ lisp_to_value (emacs_env *env, Lisp_Object o)
       /* Package the incompressible object pointer inside a pair
 	 that is compressible.  */
       Lisp_Object pair = Fcons (o, ltv_mark);
-
-      if (! HAVE_STRUCT_ATTRIBUTE_ALIGNED)
-	{
-	  /* Keep calling Fcons until it returns a compressible pair.
-	     This shouldn't take long.  */
-	  while ((intptr_t) XCONS (pair) & (GCALIGNMENT - 1))
-	    pair = Fcons (o, pair);
-
-	  /* Plant the mark.  The garbage collector will eventually
-	     reclaim any just-allocated incompressible pairs.  */
-	  XSETCDR (pair, ltv_mark);
-	}
-
       v = (emacs_value) ((intptr_t) XCONS (pair) + Lisp_Cons);
     }
 
-- 
2.13.6


  reply	other threads:[~2017-11-11  7:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171109031206.7056.28312@vcs0.savannah.gnu.org>
     [not found] ` <20171109031208.D2CAF2033E@vcs0.savannah.gnu.org>
2017-11-09 23:31   ` emacs-26 9e59de9: Use GCALIGNED properly for GCC Glenn Morris
2017-11-10  7:10     ` martin rudalics
2017-11-10  8:06       ` Eli Zaretskii
2017-11-10  8:26         ` Paul Eggert
2017-11-10  9:57           ` Eli Zaretskii
2017-11-10 16:23             ` Stefan Monnier
2017-11-10 17:58               ` Paul Eggert
2017-11-10 18:02                 ` Stefan Monnier
2017-11-10 18:11                   ` Philipp Stephani
2017-11-10 19:19                     ` Paul Eggert
2017-11-10 20:31                       ` Stefan Monnier
2017-11-10 20:45                         ` Paul Eggert
2017-11-11  7:08           ` Paul Eggert
2017-11-11  7:57             ` Paul Eggert [this message]
2017-11-11  8:34               ` martin rudalics
2017-11-11  8:50                 ` Paul Eggert
2017-11-11  9:46                   ` martin rudalics
2017-11-11  8:33             ` martin rudalics
2017-11-13 18:19               ` Paul Eggert
2017-11-13 18:45                 ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=311e52a3-67a2-375b-18e4-1a6a60f04ecb@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rgm@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).