From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Lisp_Marker size on 32bit systems Date: Fri, 07 Sep 2018 11:05:58 +0300 Message-ID: <83bm99vijd.fsf@gnu.org> References: <5a2c709e-aa49-b5b6-3fbe-fb8bd33acb23@cs.ucla.edu> <06d01a4b-9d98-df5b-be8a-aeda449acad7@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1536307511 31955 195.159.176.226 (7 Sep 2018 08:05:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 7 Sep 2018 08:05:11 +0000 (UTC) Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 07 10:05:06 2018 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 1fyBlK-0008DM-HJ for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2018 10:05:06 +0200 Original-Received: from localhost ([::1]:37299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBnQ-0008OB-Q2 for ged-emacs-devel@m.gmane.org; Fri, 07 Sep 2018 04:07:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBmD-0008MS-SK for emacs-devel@gnu.org; Fri, 07 Sep 2018 04:06:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyBmA-0001Wg-GV for emacs-devel@gnu.org; Fri, 07 Sep 2018 04:06:01 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:35417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyBmA-0001W6-CN; Fri, 07 Sep 2018 04:05:58 -0400 Original-Received: from [176.228.60.248] (port=2234 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fyBmA-0004ez-08; Fri, 07 Sep 2018 04:05:58 -0400 In-reply-to: <06d01a4b-9d98-df5b-be8a-aeda449acad7@cs.ucla.edu> (message from Paul Eggert on Fri, 7 Sep 2018 00:15:57 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:229377 Archived-At: > From: Paul Eggert > Date: Fri, 7 Sep 2018 00:15:57 -0700 > Cc: emacs-devel@gnu.org > > Stefan Monnier wrote: > > > Thanks. AFAICT the only solution is to use the GCALIGNED_UNION trick in > > each and every "real Lisp_Object struct" rather than once and forall in > > vectorlike_header. > > The trick does need to move out of union vectorlike_header. However, the trick > is not needed for most of those structs, since they're allocated only by the GC > and are therefore already GC-aligned. The trick is needed only for structs that > C might allocate statically or on the stack, and whose addresses are tagged as > Lisp pointers. Just a few types do that, and I've noted them in the first > attached patch. > > Although the first attached patch shrinks sizeof (struct Lisp_Maker) from 32 to > 24 bytes on x86 as requested, allocate_pseudovector still *allocates* 32 bytes > for the struct, as it rounds the size up to the next multiple of alignof > (max_align_t), which is 16 on x86. It's not hard to change that to 8 (please see > 2nd attached patch) but this causes a 20% CPU performance hit (!) to 'make > compile-always' on my platform (AMD Phenom II X4 910e circa 2010, Fedora 28 > x86-64, gcc -m32 -march=native), so I didn't install and can't recommend the 2nd > attached patch. The current master fails to build in the x86 32-bit configuration with wide ints: In file included from lisp.h:35:0, from window.c:25: ../lib/verify.h:207:21: error: static assertion failed: "verify (header_size == sizeof (union vectorlike_header))" # define _GL_VERIFY _Static_assert ^ ../lib/verify.h:252:20: note: in expansion of macro '_GL_VERIFY' # define verify(R) _GL_VERIFY (R, "verify (" #R ")") ^~~~~~~~~~ lisp.h:1630:1: note: in expansion of macro 'verify' verify (header_size == sizeof (union vectorlike_header)); ^~~~~~ Makefile:385: recipe for target `window.o' failed