From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: master 3ed79cd: Separate bytecode stack Date: Mon, 14 Mar 2022 16:56:20 +0100 Message-ID: <1EB42282-A67C-4C20-8E5D-BA8DA9A21E9C@acm.org> References: <83lexdlpjy.fsf@gnu.org> <447E1D53-FA02-4776-9730-507BCA1993FA@acm.org> <83h781lma9.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21235"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Mar 14 16:57:48 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 1nTn4u-0005N3-5I for ged-emacs-devel@m.gmane-mx.org; Mon, 14 Mar 2022 16:57:48 +0100 Original-Received: from localhost ([::1]:33984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTn4s-000169-QV for ged-emacs-devel@m.gmane-mx.org; Mon, 14 Mar 2022 11:57:46 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTn3e-0007Y4-CB for emacs-devel@gnu.org; Mon, 14 Mar 2022 11:56:30 -0400 Original-Received: from mail1435c50.megamailservers.eu ([91.136.14.35]:56914 helo=mail263c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTn3b-0000r3-Ly; Mon, 14 Mar 2022 11:56:29 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1647273383; bh=hb8MA5tRHlclYjihiLdb18w5O0RAz4/zNtEud9QhD1g=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=Axb827tJwhdPqaac2hAs2BJ6YdOMi83igirBjRLEbC36sCx2w0wkm6ekodNU9Qxoi 97Mr4+2iaAcBK9RZOCgPRCa0PliBBfUPstiEtUmekhYW8PgJaslCMnnVFzstm3TgFL 5hqCplIaipimmd500wU3wkAa4eC+ctsbR5xoewKk= Feedback-ID: mattiase@acm.or Original-Received: from smtpclient.apple (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail263c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 22EFuKd5021330; Mon, 14 Mar 2022 15:56:22 +0000 In-Reply-To: <83h781lma9.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-CTCH-RefID: str=0001.0A742F22.622F65A6.008D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.14.35; envelope-from=mattiase@acm.org; helo=mail263c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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" Xref: news.gmane.io gmane.emacs.devel:287154 Archived-At: 13 mars 2022 kl. 19.50 skrev Eli Zaretskii : > The warning is gone Excellent, thank you for testing! > What kind of pointers do you need to store in the > fp array, why, and for what purpose? And if you do need to do that, > why not use a union? Let's look at what we are doing. We switch to an explicit representation = of the bytecode interpreter stack. Each stack frame is composed of two = parts: a fixed-sized metadata record containing information such as = where to continue execution after the function has terminated, and a = variable-sized private data stack for the function. The size of that = data stack is specified in the bytecode object. Like most other interpreters and CPU hardware, we use the standard = solution: reserve a block of memory for a stack and carve out stack = frames from it as needed, with their two parts next to one another in = each frame. The data stack part must be an array of Lisp_Object; here we = have little choice. The metadata record consists of a few members each = of which fits into the space of a Lisp_Object, which makes the current = implementation fairly natural: store those in designated array slots. There are alternatives, several of which have been tried. One which is = basically an equivalent formulation of the same code is to use a C = struct for the metadata, then allocate it and the local data stack out = from a big untyped stack. This makes metadata access simpler and more = type-safe, and eliminates the previously needed accessor functions = (sf_get_lisp_ptr etc). The drawback is more casts between pointer types = which is slightly more risky than the straightforward XLP etc = conversions in the current code. On the other hand, it could actually be = faster depending on how friendly the compiler is. The latter alternative would become a little more palatable if we could = use flexible array struct members on all platforms. Given that we assume = C99, can we do that now?