From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: MPS image cache Date: Sun, 05 May 2024 14:01:09 +0300 Message-ID: <867cg8ed56.fsf@gnu.org> References: <875xvvp3fo.fsf@gmail.com> <87o79n0wna.fsf@gmail.com> <86ikzseipz.fsf@gnu.org> <86bk5keev3.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28630"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eller.helmut@gmail.com, emacs-devel@gnu.org To: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 05 13:01:57 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s3Zcy-0007BN-Az for ged-emacs-devel@m.gmane-mx.org; Sun, 05 May 2024 13:01:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3ZcR-0003Uu-EA; Sun, 05 May 2024 07:01:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3ZcK-0003Sx-3E for emacs-devel@gnu.org; Sun, 05 May 2024 07:01:17 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3ZcH-0005Xw-18; Sun, 05 May 2024 07:01:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=aeRBRMWY1xCXSWE/4xA2xt5sz87e9SU0vBiTdRRj1gs=; b=F8aAoKSMFq7000nZGgso n7ihOjobADG2pVN24DKvidAx7+s8I8lScrU7l7IV9HE+4edohuxOFbsu8dMiQJ8eBg2haop4AZCUv MIxcMMpovzL79kTO2dSAoXuVcUoksgABXdcYKvXOTzqK/+V0RJ1FKWRMyelMciWlU2Byakq4Uit71 rwlBgu0KMkF3per5fAUNfLhAdTGDZE0Y/59rc/yTRf+zBhEtwxPuzmsCPnbbCaeYHa5DjlFXltAkl hJh3zZoEPTDovy9oIwjIzyvjFL70Fs+cUklizyxWSb+PiGHGSLJVXF/ydmplhOqX9tiIJdi/wP//X 1E9z+HaR1x9LHQ==; In-Reply-To: (message from Gerd =?utf-8?Q?M=C3=B6llmann?= on Sun, 05 May 2024 12:36:21 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318821 Archived-At: > From: Gerd Möllmann > Cc: eller.helmut@gmail.com, emacs-devel@gnu.org > Date: Sun, 05 May 2024 12:36:21 +0200 > > Eli Zaretskii writes: > > >> Apparently it only works as is on 64-bits and so on. > > > > How can you be sure the compiler packs the struct fields, even on a > > 64-bit platform? If the fields are not packed, the struct could take > > more than 1 word on a 64-bit platform as well. Compilers are known to > > align struct members for faster access. > > It is on my platform. IME, this cannot be relied upon, unless we explicitly tell the compiler to pack (using some pragma or somesuch). > >> What do you expect me to do? > > > > Can you explain what the code is supposed to do, and why you need that > > assertion? > > I made the compiler my check my assumption at compile time. I find that > pretty cool of me. That's not what I meant. I meant to ask why we need the struct to be of the same size as a pointer? > > "we need to know how large the vector is to scan it" didn't explain it > > enough for me to understand. > > We allocate a vector of N pointers. The N is found in the header when we > scan it. It's the size of the MPS object we scan minus the header > divided by how large a pointer is. OK, but why does the struct have to fit in a single word?