From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: scratch/comp-static-data b5fc7dabb5 2/2: src/alloc.h: Add new header. Date: Sun, 20 Nov 2022 08:41:32 +0800 Message-ID: <87leo68nk3.fsf@yahoo.com> References: <166887624274.20851.208849360159299364@vcs2.savannah.gnu.org> <20221119164403.6C791C00B0F@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1619"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Vibhav Pant To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 20 01:42:17 2022 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 1owYPZ-0000DX-2Y for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Nov 2022 01:42:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owYPC-0008T2-Rp; Sat, 19 Nov 2022 19:41:54 -0500 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 1owYPA-0008Sl-Uj for emacs-devel@gnu.org; Sat, 19 Nov 2022 19:41:53 -0500 Original-Received: from sonic308-10.consmr.mail.ne1.yahoo.com ([66.163.187.33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1owYOz-0005ND-3Z for emacs-devel@gnu.org; Sat, 19 Nov 2022 19:41:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668904899; bh=YNKVIuTz9DcypHXXj2gEPxCB3GOz0GujdZLZpyOlTfI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=YROrIzQ7XNiHtpZOQbKONTQXf6alGBB7AEmbHXeCpuCO4MeBNIF27kS9JssBhyrhky0mQYgU8NkVatuaJfNx1c9ZetOLLh48rOn8RVuKHZ9Gkeo5bnqJR4tj2pK/tp00gq7rar17Ox46IcWV187ItqKJfqxaYrsa/uNGhL9IHew6OuVPs9kQNuRovYCEHXi/M3vg0tJsUFIDgUyTxNawIsyPrSkuj2KfVK775fBgf50XEaoQUdzO/Ef5Oo4u2TjUBQd47XDyH2eFVm0XcZBmmDWrw5mKB7vh7aRuP6mmScZo8gITLOx/Yhq0UEMVm9ctn6RYZzrquQDubHoT1ANhhg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668904899; bh=8MfBBy8Plb0WchsFXrZy2RioQ2dcu0SfFC1EzC+A/ST=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=HKVFt5pd1wQujRDPpfRu/5iueAABaUAZMBhSxs6Wo1FYTlm82jFjsJgbDo62ttI3xanzzI7Hli0vn5NyJXWRWPn7I2vzLvaYMXIPvSua7UlIzU9MjSRMlO47yxie+lDS8VIduirdu4CWURpvGQCsmbV7lkmhU6dNvdk07sl1COXg+x2HQMj+vL1o8HY277Y73Q/ue6SXth12egSFOHYMvSsX0QlqmJGJEk8rcWaNDVC/GGS7W6ZLldvs/VYwsY2yDtOXyDJ7GjrSzYPWE4zPEfxnRE/x6O954wU1191xoIX2E+L7Ka+hVv/A9mcIHp9210Ty1y7W+wH6GW9HVDLGMw== X-YMail-OSG: MCDlBpYVM1kd18sgN_S.HDpM1HAtw3KYkeG9b2O9NazTkbm3X5pQ6J9W3d7HH6_ 2N7FSzXqFhEJcrZ8Po56BrmTpMFtj69nsnIU1Tcs4tl218y7t8An322WPSLzfECUBtwzdAfic_bX 7DXOPXu8ZFh2L5VZz1RKDlMZG57My1xqbD2lgsqXf42HK94gx_qIMh2fVZ3TYe7.QxvtZO04LjIp fifdxoPJyreJAaszMi0iabBqz7G0Hi6HrlConciMEyYYM6vtApF007o4cB6E04A6lPJ5m.3U0xlZ QGm40JSQAWVjpIifwuFAKi1HovrSP5PgCzbjxwU.Y4UNxQHmb20zeb5Gvdm2OlHGxsf2Df5IA2Jx UVJvKdYyVTi5b8R4YocrRPkp20U6vTn71PPUIOb9m3Xvot8.IY8KTgIfptsc1IJDJ83oGjvfYW4v r.dUxLQoR5L34tAh7ZDb2bpPzMQLfdS.5qe5bDORitFdqjSRmYudE_CNN9VQl4ukKj93kpDkLELp wZz12gqUxHn6mSYBFbPT2D2P4Gp5BK3lxLLsSruFMSqASn.PtyYmjfReog6Q59ecDZs5FwrQk2kD aL4rGeZG04vdQyDh5gvm4OLlq2M8jnZ1Zs9rDoVNOSoaa6OokrUi0VLS8Ta96.LfNldJZfAbsrl. cLbEjAxg5Ra8Ic8N3M7cbtYykFvLKH7ejSiYWQTQnDS6Tng.alGnPw3g_f2rwGMd9BH3126z868F yLa4yhuHgrBI.YkjokzeaG8KxN5MEoO1T2qc4KfXPTOryzdX99RuAAzkCRdzXySni.cikZdiMQHd CQEknMXCN2tWcAZ0g9DqRQPoQOPS3J0pOqBEbaqcrL X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ne1.yahoo.com with HTTP; Sun, 20 Nov 2022 00:41:39 +0000 Original-Received: by hermes--production-sg3-6c8895b545-fzfcs (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 133813f82f2b1bb5b420d54fb9ebe3bd; Sun, 20 Nov 2022 00:41:36 +0000 (UTC) In-Reply-To: <20221119164403.6C791C00B0F@vcs2.savannah.gnu.org> (Vibhav Pant's message of "Sat, 19 Nov 2022 11:44:03 -0500 (EST)") X-Mailer: WebService/1.1.20863 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.187.33; envelope-from=luangruo@yahoo.com; helo=sonic308-10.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:300220 Archived-At: Vibhav Pant writes: > branch: scratch/comp-static-data > commit b5fc7dabb5c153336bd9268c80d9316faa34753a > Author: Vibhav Pant > Commit: Vibhav Pant > > src/alloc.h: Add new header. > > Add alloc.h, a header containing allocation-related constants that are > used by comp.c while emitting static data. > * src/alloc.h: New file. > * src/alloc.c: Set alloc.h variables only when native compilation is > enabled. You wrote the commit message wrong again. The last line should _not_ be indented to line up with "src/alloc.c". Also, why not put this stuff in lisp.h? That's how it's done in the tree where I work on the garbage collector, and it seems to be working fine. Less headers are better than more. > --- > src/alloc.c | 6 ++++++ > src/alloc.h | 35 +++++++++++++++++++++++++++++++++++ > 2 files changed, 41 insertions(+) > > diff --git a/src/alloc.c b/src/alloc.c > index 69c5dba18c..6e46d470cf 100644 > --- a/src/alloc.c > +++ b/src/alloc.c > @@ -1054,7 +1054,9 @@ lisp_free (void *block) > #define BLOCK_ALIGN (1 << 10) > verify (POWER_OF_2 (BLOCK_ALIGN)); > > +#ifdef HAVE_NATIVE_COMP > const size_t block_align = BLOCK_ALIGN; > +#endif > > /* Use aligned_alloc if it or a simple substitute is available. > Aligned allocation is incompatible with unexmacosx.c, so don't use > @@ -2547,9 +2549,11 @@ pin_string (Lisp_Object string) > - (sizeof (struct Lisp_Float) - sizeof (bits_word))) * CHAR_BIT) \ > / (sizeof (struct Lisp_Float) * CHAR_BIT + 1)) > > +#ifdef HAVE_NATIVE_COMP > const size_t float_block_floats_length = FLOAT_BLOCK_SIZE; > const size_t float_block_gcmarkbits_length > = 1 + FLOAT_BLOCK_SIZE / BITS_PER_BITS_WORD; > +#endif > > #define GETMARKBIT(block,n) \ > (((block)->gcmarkbits[(n) / BITS_PER_BITS_WORD] \ > @@ -2655,9 +2659,11 @@ make_float (double float_value) > - (sizeof (struct Lisp_Cons) - sizeof (bits_word))) * CHAR_BIT) \ > / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1)) > > +#ifdef HAVE_NATIVE_COMP > const size_t cons_block_conses_length = CONS_BLOCK_SIZE; > const size_t cons_block_gcmarkbits_length > = 1 + CONS_BLOCK_SIZE / BITS_PER_BITS_WORD; > +#endif > > #define CONS_BLOCK(fptr) \ > (eassert (!pdumper_object_p (fptr)), \ > diff --git a/src/alloc.h b/src/alloc.h > new file mode 100644 > index 0000000000..026d62c6a9 > --- /dev/null > +++ b/src/alloc.h > @@ -0,0 +1,35 @@ > +/* Allocation-related definitions, used by comp.c > + > + Copyright (C) 2019-2022 Free Software Foundation, Inc. > + > +This file is part of GNU Emacs. > + > +GNU Emacs is free software: you can redistribute it and/or modify > +it under the terms of the GNU General Public License as published by > +the Free Software Foundation, either version 3 of the License, or > +(at your option) any later version. > + > +GNU Emacs is distributed in the hope that it will be useful, > +but WITHOUT ANY WARRANTY; without even the implied warranty of > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +GNU General Public License for more details. > + > +You should have received a copy of the GNU General Public License > +along with GNU Emacs. If not, see . */ > + > +#ifndef ALLOC_H > +#define ALLOC_H > + > +#ifdef HAVE_NATIVE_COMP > + > +extern const size_t block_align; > + > +extern const size_t float_block_floats_length; > +extern const size_t float_block_gcmarkbits_length; > + > +extern const size_t cons_block_conses_length; > +extern const size_t cons_block_gcmarkbits_length; > + > +#endif /* #ifndef HAVE_NATIVE_COMP */ > + > +#endif /* #ifndef ALLOC_H */