From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Incorrect byte compiler error/warning message positions. A possible fix. Date: Mon, 15 Nov 2021 11:49:51 +0000 Message-ID: References: <87sfvy2dsl.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13050"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 15 12:50:48 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 1mmaVb-0003FI-SN for ged-emacs-devel@m.gmane-mx.org; Mon, 15 Nov 2021 12:50:47 +0100 Original-Received: from localhost ([::1]:39858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mmaVa-0005sl-T5 for ged-emacs-devel@m.gmane-mx.org; Mon, 15 Nov 2021 06:50:46 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:37686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmaUr-0004lZ-3H for emacs-devel@gnu.org; Mon, 15 Nov 2021 06:50:01 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:35717 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1mmaUk-0003T4-OG for emacs-devel@gnu.org; Mon, 15 Nov 2021 06:50:00 -0500 Original-Received: (qmail 9208 invoked by uid 3782); 15 Nov 2021 11:49:52 -0000 Original-Received: from acm.muc.de (p4fe1595c.dip0.t-ipconnect.de [79.225.89.92]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 15 Nov 2021 12:49:51 +0100 Original-Received: (qmail 6464 invoked by uid 1000); 15 Nov 2021 11:49:51 -0000 Content-Disposition: inline In-Reply-To: <87sfvy2dsl.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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" Xref: news.gmane.io gmane.emacs.devel:279489 Archived-At: Hello, Lars. On Mon, Nov 15, 2021 at 06:22:50 +0100, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > > The byte compiler reports wrong source positions in its error and > > warning messages; not every time, but perhaps most of the time. There > > are currently at least six open bugs for this problem, e.g. bug #22288. > In my experience, the vast majority of the warning messages point to the > correct position. But, yes, it does sometimes give the wrong position. On 2018-11-22 (before you destroyed my test dataset by fixing all the warnings in Emacs ;-) there were 335 warnings. 81 gave the correct location, 254 a wrong one. > > In the new scheme it is no longer true that (eq # 'foo). > > The Lisp form for a function being compiled is manipulated as at > > present, only its symbols will have positions. These will get stripped > > out of the symbols before final code generation. > Hm... interesting. But couldn't the same stripping be done even if the > symbols are eq? That way eq would be slower during byte compilation, > but not otherwise? That's what I tried three years ago. `eq' works mainly with the EQ macro in src/lisp.h. It works with a straight comparison of two 64 (or 32) bit words. When that was augmented by a test of symbol_with_pos_p (which was always zero outside of byte compilation), the performance of Emacs dropped that 8% - 15% that people objected to so much. > > The biggest problem is with macros, and I think I can solve this. > There's also an issue with byte-hunk-handlers and byte-optimizer forms > (etc), I'd guess? They inspect the forms and do operations based on the > symbols. They should be fairly easy (if, perhaps, tedious) to solve, because everything is under our control. It's macros where people outside of our control do wierd and wonderful things. I think I know how to compile macros so that they both work, yet preserve the symbols with position on the code they generate. These compiled macros won't work on earlier versions of Emacs, but that's a bridge to cross when we come to it. > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany).