From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: How does nativecomp compile circular lists? Date: Tue, 27 Jul 2021 09:28:50 +0000 Message-ID: References: Reply-To: Andrea Corallo Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21179"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Emacs-Devel devel To: Jimmy Yuen Ho Wong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 27 11:32:40 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 1m8JS3-0005Oa-TE for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Jul 2021 11:32:39 +0200 Original-Received: from localhost ([::1]:34924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m8JS2-0004UW-RH for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Jul 2021 05:32:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m8JR4-00039z-Ak for emacs-devel@gnu.org; Tue, 27 Jul 2021 05:31:38 -0400 Original-Received: from mx.sdf.org ([205.166.94.24]:50141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m8JR0-0003HK-AF for emacs-devel@gnu.org; Tue, 27 Jul 2021 05:31:38 -0400 Original-Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 16R9SoMd009310 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Tue, 27 Jul 2021 09:28:51 GMT In-Reply-To: (Jimmy Yuen Ho Wong's message of "Tue, 27 Jul 2021 08:21:51 +0100") Received-SPF: pass client-ip=205.166.94.24; envelope-from=akrl@sdf.org; helo=mx.sdf.org 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_PASS=-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.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:271687 Archived-At: Jimmy Yuen Ho Wong writes: > I'm not exactly sure how to even ask this question, as I've seen various packages fail to natively compile circular lists > or optimize it wrongly. So I've come up with a simple test case for me to be able to disassemble the bytecode and the > native code, and see if I could spot the problem, but disassembling natively compiled code doesn't seem to work. > > Test case: > > (defun test-circular-list () > (let ((l (list 1 2 3))) > (setcdr (last l) l) > l)) > > (print (test-circular-list)) > > (provide 'test-circular-list) > > M-x emacs-lisp-byte-compile-and-load > M-x disassemble RET test-circular-list (works) > > M-x emacs-lisp-native-compile-and-load > M-x disassemble RET test-circular-list (doesn't work) > > Debugger entered--Lisp error: (search-failed "^.* re-search-forward("^.* disassemble-internal(test-circular-list 0 nil) > disassemble(test-circular-list nil 0 t) > funcall-interactively(disassemble test-circular-list nil 0 t) > command-execute(disassemble record) > execute-extended-command(nil "disassemble" nil) > funcall-interactively(execute-extended-command nil "disassemble" nil) > command-execute(execute-extended-command) > > Furthermore, this test case, though superficially similar, doesn't seem to be able to reproduce the same failure to > natively compile issue as seen in powerline. > > There seems to be more than one thing wrong with this journey into my deep dive into how native compiling circular lists > work. > > Jimmy Yuen Ho Wong > Hi Jimmy, I'm failing to reproduce this issue. Disassembling following your instructions works here. Also the compiled `test-circular-list' function as expected here. Am I missing something? Best Regards Andrea