From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: emacs-26 9e59de9: Use GCALIGNED properly for GCC Date: Fri, 10 Nov 2017 23:57:13 -0800 Organization: UCLA Computer Science Department Message-ID: <311e52a3-67a2-375b-18e4-1a6a60f04ecb@cs.ucla.edu> References: <20171109031206.7056.28312@vcs0.savannah.gnu.org> <20171109031208.D2CAF2033E@vcs0.savannah.gnu.org> <5A0550FE.2030703@gmx.at> <83zi7upnfo.fsf@gnu.org> <4ee60712-789e-f160-52a9-4e24a9733a11@cs.ucla.edu> <899d6f0d-78d2-a954-1c97-c0088cdd6337@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------CB4241753D5AC93374E3CEDB" X-Trace: blaine.gmane.org 1510387052 8536 195.159.176.226 (11 Nov 2017 07:57:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 11 Nov 2017 07:57:32 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 Cc: rgm@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii , martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 11 08:57:28 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eDQfP-0001vU-Sb for ged-emacs-devel@m.gmane.org; Sat, 11 Nov 2017 08:57:28 +0100 Original-Received: from localhost ([::1]:44754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDQfX-0003bO-AM for ged-emacs-devel@m.gmane.org; Sat, 11 Nov 2017 02:57:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eDQfQ-0003bH-VR for emacs-devel@gnu.org; Sat, 11 Nov 2017 02:57:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eDQfQ-0007ux-2h for emacs-devel@gnu.org; Sat, 11 Nov 2017 02:57:29 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50912) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eDQfJ-0007t5-Jj; Sat, 11 Nov 2017 02:57:21 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2C45F1610E7; Fri, 10 Nov 2017 23:57:19 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id V4MkwF64OJHY; Fri, 10 Nov 2017 23:57:14 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 303691610EF; Fri, 10 Nov 2017 23:57:14 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yJ1stGUSPnd9; Fri, 10 Nov 2017 23:57:14 -0800 (PST) Original-Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 061281610EA; Fri, 10 Nov 2017 23:57:14 -0800 (PST) In-Reply-To: <899d6f0d-78d2-a954-1c97-c0088cdd6337@cs.ucla.edu> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:220053 Archived-At: This is a multi-part message in MIME format. --------------CB4241753D5AC93374E3CEDB Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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. --------------CB4241753D5AC93374E3CEDB Content-Type: text/x-patch; name="0001-Simplify-by-removing-HAVE_STRUCT_ATTRIBUTE_ALIGNED.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Simplify-by-removing-HAVE_STRUCT_ATTRIBUTE_ALIGNED.patc"; filename*1="h" >From 5ad538acf5cc34f26420780fa642bce02a88d0ee Mon Sep 17 00:00:00 2001 From: Paul Eggert 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 - 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 --------------CB4241753D5AC93374E3CEDB--