From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#53632: Function definition history Date: Sun, 30 Jan 2022 09:43:12 +0200 Message-ID: <831r0pbre7.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25779"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 53632@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 30 08:46:38 2022 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 1nE4uz-0006XV-JR for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Jan 2022 08:46:37 +0100 Original-Received: from localhost ([::1]:44664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nE4ux-0006u4-Sr for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Jan 2022 02:46:35 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nE4sU-0006sN-ND for bug-gnu-emacs@gnu.org; Sun, 30 Jan 2022 02:44:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nE4sU-0008MN-BT for bug-gnu-emacs@gnu.org; Sun, 30 Jan 2022 02:44:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nE4sU-0000oi-0M for bug-gnu-emacs@gnu.org; Sun, 30 Jan 2022 02:44:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Jan 2022 07:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53632 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 53632-submit@debbugs.gnu.org id=B53632.16435286083086 (code B ref 53632); Sun, 30 Jan 2022 07:44:01 +0000 Original-Received: (at 53632) by debbugs.gnu.org; 30 Jan 2022 07:43:28 +0000 Original-Received: from localhost ([127.0.0.1]:35495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nE4rw-0000nh-H4 for submit@debbugs.gnu.org; Sun, 30 Jan 2022 02:43:28 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nE4rt-0000nR-CR for 53632@debbugs.gnu.org; Sun, 30 Jan 2022 02:43:26 -0500 Original-Received: from [2001:470:142:3::e] (port=43050 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nE4ro-0008KT-3M; Sun, 30 Jan 2022 02:43:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jMCmDiOCc6xs9E7/YWlsJqbHqVyY4L3NdU7JoQTH2X8=; b=mG77erOC7X+h pyEz5IQ2chtS6f75OKcfZY9D5iAL4CC5w8OxGKPKJwDvMoJ1h9nboC5nXhnoe9tfQywYgxutRIla5 7QDELgiKf9Kn9XkEMosFCKbOMo42n65X0wkZyk0oT/YSltFIsrk09XVACDjTIZQHlDB/+ob8sZ+IS kuBS+UpK/a6Ofvmw4Pjip3al55PxIKIWGW2BsqKt5hF4EieGr0qo1k5g1Q37tSMH7f1r47/PLtM9l laISURQJXzx61Jc3QDBGoAtLCRjzqxc+XDJJa+BzeliqA72f6pg1nZKx5UsvpUuVA7wlYw8/EW9hX 0T3QBKYo29dpULpYIDIQlQ==; Original-Received: from [87.69.77.57] (port=3488 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nE4rn-00041I-Go; Sun, 30 Jan 2022 02:43:19 -0500 In-Reply-To: (bug-gnu-emacs@gnu.org) 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:225589 Archived-At: > Date: Sun, 30 Jan 2022 00:07:57 -0500 > From: Stefan Monnier via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > I suggest to replace that info with something slightly more complete. > In the patch below I store the history of the function definition of > a symbol in its `function-history` symbol property. This history is > stored as a list of the form (... VAL(n+1) FILE(n+1) VALn FILEn ...) > where VALn is the value set by FILEn. To make this list cheap in the > default case, the latest value is not stored in the list (since it's in > the `symbol-function`) and neither is the first file. So if there's > only been a single definition (the most common case), the list is empty > and the property is just not present at all. If a function was first > defined as an autoload and then overriden by the actual function > definition, then the list will hold (FILE2 AUTOLOAD), i.e. the name of > the file that provided the actual function definition and the autoload > that was used before that. > [ Note: the name of the file that provided the first definition can be > recovered if really needed by checking all entries in `load-history`. > In the patch below I have not needed it. ] > > This makes it possible to handle correctly things like unloading > `cl-loaddefs.el` which should remove the autoloads that are still > autoloads and leave untouched the functions whose autoload have been > replaced by the actual function definition. > > In my tests it increased the size of the .pdmp by about 2KB (on a 32bit > build). > > The patch also gets rid of the `autoload` vs `defun` distinction in > `load-history` which seems unnecessary (a significant part of the > motivation for this patch was to get rid of the special handling of > autoloads in this part of the code). At least I couldn't find any place > in the code which took advantage of that distinction. > > Comments? Objections? Please make sure to document this in the ELisp manual.