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 5252c45: Initialise unread buffer Date: Mon, 20 Sep 2021 12:16:24 +0200 Message-ID: <0344BE6C-99E1-4DBB-ABD7-454DCF6C012B@acm.org> References: <20210919142251.2698.98689@vcs0.savannah.gnu.org> <20210919142252.B0B1520ABE@vcs0.savannah.gnu.org> <87lf3spro4.fsf@gnus.org> <87pmt4obr1.fsf@gnus.org> <91607831-8815-4882-8688-D48722737D9E@acm.org> <87sfy0mv33.fsf@gnus.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) 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="7188"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs developers To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 20 12:18:30 2021 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 1mSGNa-0001g8-D6 for ged-emacs-devel@m.gmane-mx.org; Mon, 20 Sep 2021 12:18:30 +0200 Original-Received: from localhost ([::1]:47622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSGNY-0006oK-UA for ged-emacs-devel@m.gmane-mx.org; Mon, 20 Sep 2021 06:18:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSGLu-0004lk-Pr for emacs-devel@gnu.org; Mon, 20 Sep 2021 06:16:47 -0400 Original-Received: from mail1457c50.megamailservers.eu ([91.136.14.57]:38328 helo=mail267c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSGLe-0001id-Re for emacs-devel@gnu.org; Mon, 20 Sep 2021 06:16:46 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1632132986; bh=QRaKOtyadHC8yvw9qLfPkgk0VvBEkW+qQsRrS/+Ans0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=mzMriimVjnoj/NGP3uXdmgE6oSn7OV5rKusk4Zg5WAXH6LIIfO7Mhd58G0DwduLDe 0mJFa9wYqHefrDaT8f+ehLfppn7MDIOdNrXLfH5dIJcHTv2txpQTa6c4Oe18cX2377 hEyk/0xmLXD6OdKZ93MHdEocHrlEkmG22g7O6sPM= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail267c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 18KAGODe002917; Mon, 20 Sep 2021 10:16:26 +0000 In-Reply-To: <87sfy0mv33.fsf@gnus.org> X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F29.61485F7A.0055, 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-CSC: 0 X-CHA: v=2.4 cv=Zf5+iuZA c=1 sm=1 tr=0 ts=61485f7a a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=OocQHUDgAAAA:8 a=nvlQEshLiZg4qfv-KfkA:9 a=CjuIK1q_8ugA:10 a=xUZTl98r3Qw_uB5NK3jt:22 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.14.57; envelope-from=mattiase@acm.org; helo=mail267c50.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_SOFTFAIL=0.665, T_SPF_HELO_TEMPERROR=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:275121 Archived-At: 19 sep. 2021 kl. 17.41 skrev Lars Ingebrigtsen : > I'm not absolutely sure that it's your change that's causing this = weird > error, but it seemed the most likely. :-/ And reverting back to the > checkout before yours made the problem go away. It's more fun actually. Thanks to the fixed reader bug, the = lexical-binding cookie is now honoured in loadup.el. That causes Emacs = to be dumped with `lexical-binding` set to t which as a consequence = becomes the new default. It's a testament to the sterling work by Stefan, Stefan, you, and = everybody else that Emacs seems to work almost flawlessly anyway, but as = it really wasn't our intention to do the switch now I've pushed an = explicit binding of lexical-binding around the actual dumping so we're = now back to normal. What about the failing eval-tests then? They check, among other things, = that (lambda (&rest) 'ok) can be interpreted, byte-compiled, and returns `ok` when called. This = fails with lexical binding enabled but works with dynamic binding, so = when the default was inadvertently switched to lexical, the test started = failing. But wait, you protest. eval-tests.el is marked with -*- lexical-binding: = t -*-. Surely? No? Actually, any code in `ert-deftest` uses dynamic binding (until the = accidental switch), regardless of the file cookie. Not many people know = that. So what is this bug that is still present? Let's take a look: (byte-compile (lambda (&rest) 'ok)) =3D> #[128 "\300\207" [ok] 1 "..."] Let's pick it apart: - The number 128 means that there are no positional args but a single = &rest argument. - The "\300\207" are the two byte-ops constant ok ; push `ok` on the stack return ; return the value on top of the stack - The number 1 is the maximum stack size required. When byte-code execution starts, the arguments are pushed on the stack = -- in this case, a single nil for the &rest. The first byte-op then = pushes the constant `ok`. But the stack is only sized for one element so = that overwrites what follows, which is a copy of the byte-code. The = smashed ops are then executed: if we are lucky we get an error, if = unlucky an Emacs abort or crash. I'm not sure why the byte-code interpreter makes a copy of the byte code = for each function call. It certainly doesn't help the lamentably high = function call overhead a bit. Most likely it's programmer, not code, = efficiency that was optimised: since GC can move string data, the pc = would need to be rebased each time that can occur, and that might need = to be done in a lot of places. We should probably do something about = that. If the argument is named, then we get: (byte-compile (lambda (&rest _x) 'ok)) =3D> #[128 "\300\207" [ok] 2 "..."] Note the max depth 2 here which gives a sufficiently big stack. There's a number of things to fix here, but this message is too long = already. Thanks for your interest! There are books for sale in the = foyer.