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: Circular records: how do I best handle them? (The new correct warning position branch now bootstraps in native compilation!) Date: Thu, 23 Dec 2021 21:15:16 +0000 Message-ID: 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="13850"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 23 22:17:28 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 1n0VSq-0003Oh-1F for ged-emacs-devel@m.gmane-mx.org; Thu, 23 Dec 2021 22:17:28 +0100 Original-Received: from localhost ([::1]:39542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0VSn-0007Ze-RC for ged-emacs-devel@m.gmane-mx.org; Thu, 23 Dec 2021 16:17:25 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0VQz-0006A3-8X for emacs-devel@gnu.org; Thu, 23 Dec 2021 16:15:34 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:53242 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1n0VQw-00071f-Dy for emacs-devel@gnu.org; Thu, 23 Dec 2021 16:15:32 -0500 Original-Received: (qmail 30948 invoked by uid 3782); 23 Dec 2021 21:15:18 -0000 Original-Received: from acm.muc.de (p4fe153f8.dip0.t-ipconnect.de [79.225.83.248]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 23 Dec 2021 22:15:17 +0100 Original-Received: (qmail 15148 invoked by uid 1000); 23 Dec 2021 21:15:16 -0000 Content-Disposition: inline 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: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, PLING_QUERY=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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:283045 Archived-At: Hello, Emacs. Firstly, the scratch/correct-warning-pos git branch (which is to deliver the correct source code position in byte compilation warning messages) bootstrapped with native compilation for the first time yesterday evening. Basically, it is now working. :-) However, several files.el failed to compile due to infinite recursion. A bit of gdb'ing in Ffuncall showed that whilst compiling ffap.el (at least), there were circular record structures (where @dfn{records} are a pseudovector type very like normal vectors, but with their zeroth element supposedly representing their type with a symbol). The recursion was in the (new) function `byte-compile-strip-s-p-1' (where "strip-s-p" stands for "strip-symbol-positions"). This function recursively descends list and vector structures, stripping positions from symbols-with-position it finds. However, I seem to have circularity in a record structure, where two records seem to point to eachother. I suspect that it is the zeroth elements of these records (which are meant to be symbols) that are pointing at eachother. Would somebody (?Stefan M, perhaps) please suggest to me how I might efficiently cope with these circular structures. Do I need to maintain a list of already encountered Lisp Objects, somehow, and check this list before recursing into the function? It would be nice if the new mechanism were reasonably efficient (but I don't know how important that is). Thanks! -- Alan Mackenzie (Nuremberg, Germany).