From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#67005: 30.0.50; improve nadivce/comp/trampoline handling Date: Wed, 08 Nov 2023 17:50:58 -0500 Message-ID: References: <874jhv9921.fsf@sappc2.fritz.box> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7967"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: andrea corallo , 67005@debbugs.gnu.org To: Jens Schmidt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 08 23:54:44 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1r0rRb-0001q1-FG for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Nov 2023 23:54:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0rRJ-0008DF-Kh; Wed, 08 Nov 2023 17:54:25 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0rRI-0008Cs-1b for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 17:54:24 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0rRH-0002p8-Q5 for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 17:54:23 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r0rRu-0007z1-4s for bug-gnu-emacs@gnu.org; Wed, 08 Nov 2023 17:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Nov 2023 22:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67005 X-GNU-PR-Package: emacs Original-Received: via spool by 67005-submit@debbugs.gnu.org id=B67005.169948406130630 (code B ref 67005); Wed, 08 Nov 2023 22:55:02 +0000 Original-Received: (at 67005) by debbugs.gnu.org; 8 Nov 2023 22:54:21 +0000 Original-Received: from localhost ([127.0.0.1]:46438 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0rRF-0007xx-48 for submit@debbugs.gnu.org; Wed, 08 Nov 2023 17:54:21 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:27971) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r0rRD-0007xh-70 for 67005@debbugs.gnu.org; Wed, 08 Nov 2023 17:54:20 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 01C2E806F7; Wed, 8 Nov 2023 17:53:35 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1699484014; bh=fFmjiOemO7tlOAJhXOa38U2wKfd+reIJYMMRH2wlTYQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=JqCT52KEplO++ggvra7zQ2jiGDL2s6clGIt1O4MpfBrNFdFoKnLSkozNRRbL1ThhN Pqgu9N+2Th8qNIXkIq76inggqmlSdvsIUWKj++v3t7xgzU8G/SR4AiCWSlxeawrhh8 hLU2k7KJ9YaWbHejhWemRJ3F119DZf18m1wq6zNAp6Xsus7THyC+XBUOCOaYt47a7h R7Dc8wC2aUnYCpE1lnVU9qELMDw9aLLaFMAapH/IoiA1Yws1ZgWzQEIA2om5gh4fZI L2ZmFmfA5W5KZsRRbwhp1YCxDKB4lpN97W+YghCNTdwUioadqTRrOQEzVKWD4V+p3Q rWrc2b0ESOjcA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EE664805E6; Wed, 8 Nov 2023 17:53:33 -0500 (EST) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D170F120352; Wed, 8 Nov 2023 17:53:33 -0500 (EST) In-Reply-To: <874jhv9921.fsf@sappc2.fritz.box> (Jens Schmidt's message of "Wed, 08 Nov 2023 23:25:42 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274023 Archived-At: > 1. Since Stefan has removed the advices on uniquify functions in > 1a724cc2d2e7, that special handling of `rename-buffer' in > `advice--add-function' and `native-comp-never-optimize-functions' > seems to be obsolete. Away with it: +1 > 2. The comment in `advice--add-function' says that `macroexpand' causes > a circular dependency, and there *are* still advices done on > `macroexpand' (at least in `cl-symbol-macrolet'). But probably these > are not executed during the bootstrap? Let's try. +1 > 3. But then on the other hand, function Ffset also calls > `comp-subr-trampoline-install', and if we have condition > > `(subr-primitive-p (gv-deref ref))' > > fulfilled in `advice--add-function', then the following `(setf > (gv-deref ref) ...)' should ultimately call `fset'. So probably we > can completely remove that `comp-subr-trampoline-install' call from > `advice--add-function', like this: It looks good to me, tho I must admit I do not understand why we have this `comp-subr-trampoline-install` in addition to the one in `Ffset`, so maybe I'm missing something. > 5. And actually I think that b) above probably is a bug: It means that > for advised subrs, the optimzation to indirect calls in function > `comp-call-optim-form-call' never takes place. > > So I tried to recognize subrs in function `comp-call-optim-form-call' > even when they are advised: I think this is not a correct optimization, as you mention: > But: Natively compiled code now does NOT execute the advice on > `rename-buffer' added in step 4, since its call gets optimized but no > trampoline has been created for it. So it's a -1 from me on this patch. > 6. So there is the question whether we should actively disallow advices > during bootstrap, now that we are free of them. Like this: Rather than `dump-mode`, I'd test `purify-flag`. This is because `purify-flag` is not set while building `src/bootstrap-emacs`. Part of the issue here is that during the build of `src/bootstrap-emacs` we load a lot more ELisp code than in the "real" build so it's good to restrict this constraint to the "real build". Stefan