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 "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#5863: defadvice in byte compiled file does not work Date: Thu, 19 Nov 2020 08:14:54 +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="11484"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Andreas Schwab , Stefan Kangas , Lennart Borgman , 5863@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 19 09:15:12 2020 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 1kff5z-0002ru-SD for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Nov 2020 09:15:11 +0100 Original-Received: from localhost ([::1]:36882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kff5y-00055N-HO for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Nov 2020 03:15:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kff5q-000552-JJ for bug-gnu-emacs@gnu.org; Thu, 19 Nov 2020 03:15:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:54718) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kff5q-0007xW-8p for bug-gnu-emacs@gnu.org; Thu, 19 Nov 2020 03:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kff5q-0003Xf-28 for bug-gnu-emacs@gnu.org; Thu, 19 Nov 2020 03:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Nov 2020 08:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5863 X-GNU-PR-Package: emacs Original-Received: via spool by 5863-submit@debbugs.gnu.org id=B5863.160577369913594 (code B ref 5863); Thu, 19 Nov 2020 08:15:02 +0000 Original-Received: (at 5863) by debbugs.gnu.org; 19 Nov 2020 08:14:59 +0000 Original-Received: from localhost ([127.0.0.1]:38031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kff5n-0003XB-0E for submit@debbugs.gnu.org; Thu, 19 Nov 2020 03:14:59 -0500 Original-Received: from mx.sdf.org ([205.166.94.24]:58613) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kff5k-0003X1-UD for 5863@debbugs.gnu.org; Thu, 19 Nov 2020 03:14:57 -0500 Original-Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTP id 0AJ8EsN9011334; Thu, 19 Nov 2020 08:14:54 GMT In-Reply-To: (Stefan Monnier's message of "Thu, 19 Nov 2020 00:20:16 -0500") 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" Xref: news.gmane.io gmane.emacs.bugs:193707 Archived-At: Stefan Monnier writes: >> BTW, it seems like advising primitives will work once we get native-comp >> merged: >> >> The result of this procedure is that each newly activated function will >> use the trampoline in place of the original primitive and the >> trampoline will execute the call going through funcall making the >> advice effective! >> >> This works so well that in-fact now is even possible to advice >> effectively what wasn't effective in byte-code (ex the + function). But >> hey, don't try this a home! >> >> https://akrl.sdf.org/gccemacs.html#org3b7398e > > AFAIK this still won't cover all cases: we'd additionally have to > arrange for C calls to F to go through the trampoline. Maybe we > can do that cheaply, I don't know. I think there's no way we'll be able to fix the C to C case without some very measurable performance impact. For essentially the same reason the nativecomp trick does not work for the (few) functions we opencode. Ex on optimized compiled code redefining or advising `1+' will not take effect. So yeah works better but is still not perfect. > In any case, I think the story is still sufficiently complex that we're > better off saying that "it may work or not depending on your luck". thus agree. Andrea